MATLAB Answers


How to put the figure on on uipanel?

Muhammad Farooq Zia さんによって質問されました 2018 年 8 月 9 日
最新アクティビティ Ameer Hamza
さんによって コメントされました 2018 年 8 月 9 日
I am trying to display a figure that opens in a separate window on a uipanel. The attached picture describes what I want. I am also attaching the part of code that generates the figure. Please help me out with this.
title('Fw and dFw/dSw')
xlabel('Sw') %%
yyaxis left
plot (x,y3,tangx,tangy)
ylim([min(y3) max(y3)])%%
yyaxis right
plot (x,y4)
ylim([min(y4) max(y4)])%%
grid on
grid minor
legend('Location','NorthWest' )

  0 件のコメント

サインイン to comment.

1 件の回答

Ameer Hamza
回答者: Ameer Hamza
2018 年 8 月 9 日

You can't directly plot on the uipanel object. You first need to overlay an axes object in the panel and then plot on the axes object. For example, try
h = figure;
p = uipanel('Title','Panel', 'Position',[.1 .1 .8 .8]);
ax = axes(p);
plot(ax, 1:20, 1:20)

  4 件のコメント

Ameer Hamza
2018 年 8 月 9 日
yyaxis() works in app designer and it is supported after R2016b. Are you using an older version? Also, you need to write it like this
yyaxis(app.UIAxes, 'right');
simply writing yyaxis like MATLAB script does not work here.
Muhammad Farooq Zia 2018 年 8 月 9 日
It works...Thanks a lot bro
Ameer Hamza
2018 年 8 月 9 日
You are welcome.

サインイン to comment.

Translated by