Plotting figures of a function in GUIDE
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposte (1)
David Sanchez
il 12 Giu 2013
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.
Vedere anche
Categorie
Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!