Filter löschen
Filter löschen

Show figure

77 Ansichten (letzte 30 Tage)
Cruise
Cruise am 24 Nov. 2011
Hi everybody.
I have a GUI to plot a 3D graph.My problem is graph showed in GUI.I want to show graph in separate figure.Thank all advice. It's my code callback function of pushbutton.
function pushbutton1_Callback(hObject, eventdata, 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)
a1=str2num(get(handles.x1,'String'));
b1=str2num(get(handles.y1,'String'));
c1=str2num(get(handles.z1,'String'));
a2=str2num(get(handles.x2,'String'));
b2=str2num(get(handles.y2,'String'));
c2=str2num(get(handles.z2,'String'));
a3=str2num(get(handles.x3,'String'));
b3=str2num(get(handles.y3,'String'));
c3=str2num(get(handles.z3,'String'));
plot3 ([a1 a2 a3],[b1 b2 b3],[c1 c2 c3],'Marker','o','LineStyle','-');
grid on
rotate3d on

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 24 Nov. 2011
function pushbutton1_Callback(hObject, eventdata, 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)
a1=str2num(get(handles.x1,'String'));
b1=str2num(get(handles.y1,'String'));
c1=str2num(get(handles.z1,'String'));
a2=str2num(get(handles.x2,'String'));
b2=str2num(get(handles.y2,'String'));
c2=str2num(get(handles.z2,'String'));
a3=str2num(get(handles.x3,'String'));
b3=str2num(get(handles.y3,'String'));
c3=str2num(get(handles.z3,'String'));
f = figure();
ax = axes('Parent',f); %corrected from my original version
plot3 (ax, [a1 a2 a3],[b1 b2 b3],[c1 c2 c3], 'Marker','o','LineStyle','-');
grid(ax, 'on')
rotate3d(ax, 'on')
  3 Kommentare
Walter Roberson
Walter Roberson am 25 Nov. 2011
Bearbeitet: Randy Souza am 15 Aug. 2012
Cruise, try instead
ax = axes('Parent',f)
Cruise
Cruise am 25 Nov. 2011
Bearbeitet: Randy Souza am 15 Aug. 2012
It's OK. Thanks a lot.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Ricky
Ricky am 24 Nov. 2011
Bearbeitet: Randy Souza am 15 Aug. 2012
You can insert a command figure in between the graph that you plot like this:
a1=str2num(get(handles.x1,'String'));
figure(1);
b1=str2num(get(handles.y1,'String'));
figure(2);
...
Is that what you are after?
  1 Kommentar
Cruise
Cruise am 25 Nov. 2011
Thank you so much!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by