Effacer les filtres
Effacer les filtres

Show figure

83 vues (au cours des 30 derniers jours)
Cruise
Cruise le 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

Réponse acceptée

Walter Roberson
Walter Roberson le 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 commentaires
Walter Roberson
Walter Roberson le 25 Nov 2011
Modifié(e) : Randy Souza le 15 Août 2012
Cruise, try instead
ax = axes('Parent',f)
Cruise
Cruise le 25 Nov 2011
Modifié(e) : Randy Souza le 15 Août 2012
It's OK. Thanks a lot.

Connectez-vous pour commenter.

Plus de réponses (1)

Ricky
Ricky le 24 Nov 2011
Modifié(e) : Randy Souza le 15 Août 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 commentaire
Cruise
Cruise le 25 Nov 2011
Thank you so much!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by