Plot 2 Graphs in GUI

2 ビュー (過去 30 日間)
Kai Hao Then
Kai Hao Then 2011 年 3 月 23 日
コメント済み: sama 2015 年 10 月 13 日
How to plot 2 graphs using the 2 axes and 2 push buttons? I have created 2 axes and 2 push buttons namely as below:
axes1
axes2
pushbutton1
pushbutton2
In the pushbutton1 property I have inserted the "Callback" column with
>>plot(simout.time,simout.signals.values)
from my simulink.
In the pushbutton2, I did the same thing to the "Callback" as
>>plot(simout1.time,simout.signals.values)
from my simulink.
The "keypressFcn" in pushbutton1 and pushbutton2 are referred to axes1 and axes2 respectively. However, the result only shown in axes1 when I press those 2 buttons. What is the problem?

採用された回答

Paulo Silva
Paulo Silva 2011 年 3 月 23 日
You can select what's the current axes like this
axes(h) %h is the handle for the axes, for example h=handles.axes1
%your code goes here, any graphic function will appear on axes1
  3 件のコメント
Paulo Silva
Paulo Silva 2011 年 3 月 23 日
axes(axes1);plot(simout.time,simout.signals.values)
Paulo Silva
Paulo Silva 2011 年 3 月 23 日
put the code inside '''''

サインインしてコメントする。

その他の回答 (1 件)

Jarrod Rivituso
Jarrod Rivituso 2011 年 3 月 23 日
Try directing the plot to the axes handle.
For instance...
>> ah1 = subplot(2,1,1);
>> ah2 = subplot(2,1,2);
>> plot(ah1,1:10)
  4 件のコメント
Kai Hao Then
Kai Hao Then 2011 年 3 月 24 日
However, I still get an error running this GUIDE.
??? Undefined variable "handles" or class "handles.axes1".
??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn
Please advise.
sama
sama 2015 年 10 月 13 日
@Jarrod Rivituso Your answer helped me thanks a lot. I have a quick question please. When I use subplot and push bottom, the plots are stretched and cover all other bottoms.Would you please give me advice!Thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by