Plot 2 Graphs in GUI
显示 更早的评论
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?
采纳的回答
更多回答(1 个)
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
2011-3-23
Jarrod Rivituso
2011-3-23
It sounds like you are using GUIDE. GUIDE callbacks all have a third input argument that is a structure of handles.
So, if you are using GUIDE, you should be able to write something like...
>> plot(handles.axes1,x,y)
Kai Hao Then
2011-3-24
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
类别
在 帮助中心 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!