Plotting figures of a function in GUIDE
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
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.
参考
カテゴリ
Help Center および File 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!