How to assign a plot to a variable?
31 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Danny
am 25 Okt. 2014
Beantwortet: Image Analyst
am 25 Okt. 2014
How can we assign a plot to a variable such that when we type the variable the plot appears (as opposed to a number or equation)?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 25 Okt. 2014
If the plot is on it's own figure, you can get the figure handle first:
hFig1 = figure;
plot(1:9, 'b-');
% more code to do stuff on other figures;
% Now switch back to the first figure:
figure(hFig1);
If you're on the same figure, you can use the axes handle to switch focus to the axes you want:
axes(handles.axes1);
plot(1:9, 'b-');
% Switch focus to second plot on the same figure.
axes(handles.axes2);
plot(sin(0:0.1:2*pi), 'b-');
% Switch back to axes #1
axes(handles.axes1);
plot(2:25, 'r-');
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots 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!