Azzera filtri
Azzera filtri

Show figure

69 visualizzazioni (ultimi 30 giorni)
Cruise
Cruise il 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

Risposta accettata

Walter Roberson
Walter Roberson il 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 Commenti
Walter Roberson
Walter Roberson il 25 Nov 2011
Modificato: Randy Souza il 15 Ago 2012
Cruise, try instead
ax = axes('Parent',f)
Cruise
Cruise il 25 Nov 2011
Modificato: Randy Souza il 15 Ago 2012
It's OK. Thanks a lot.

Accedi per commentare.

Più risposte (1)

Ricky
Ricky il 24 Nov 2011
Modificato: Randy Souza il 15 Ago 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 Commento
Cruise
Cruise il 25 Nov 2011
Thank you so much!

Accedi per commentare.

Categorie

Scopri di più su Graphics Object Properties 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!

Translated by