Plotting figures of a function in GUIDE

1 次查看(过去 30 天)
G
G 2013-6-12
I have function that sucessfully plots several figures all contained in a given .m file. They are created with this code:
function [ X ] = anime_funk000( FLEXMAG,MODE,SR,AS,TS,TE )
...
fHandle1 = figure(1) %creates new figure and stores all figure data in handle, fHandle1
plot(xlin3,zlin3);
plot(t,xfn,'-r');
hold on
plot(t,xbn,'-.b');
if abs(sum(hrm)) > 0
plot(xam,hrm,'-g','linewidth',2)
hold on
plot(xan,hrn,'-.r','linewidth',1)
hold on
else
plot([xaxismin,xaxismax],[0,0],'-g','linewidth',2)
hold on
end
...etc
I am using GUIDE and trying to plot each individual figure in its own seperate axes set within the GUI but I can't get it to call the handles correctly.
The code from the GUI is as follows:
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
anime_funk000(100,0,4,1,0,50); %assigned values to function for this example
set(fHandle1,'CurrentAxes',handles.axes1);
axes(handles.axes1);
guidata(hObject, handles);
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
..etc
The button in my GUI will call the function and create the figure but does not add them to the GUI like I want.

回答(1 个)

David Sanchez
David Sanchez 2013-6-12
Every axes on your GUI has a tag propoerty ( see in property inspector ). To plot anything on a specific axes:
plot(x,y,'Parent',handles.axes2)
where x, y is your data, and axes2 is the tag assigned to your axes within the GUI.
  1 个评论
G
G 2013-6-12
The figure I am wanting to plot contains multiple "plots." In order to make it more streamlined, I am wanting to set an entire figure to an axes in the GUI.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by