Having trouble assigning a handle variable to a figure with subplots
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, I am still new to MATLAB and having difficulty understanding how to work with figure handles. I have a plot with subplots and multiple graphs within it and would like to pass the entire figure up through the function it is called to be displayed somewhere else only if certain conditions are met. Here is a simplified example of one figure:
x = (1:25)';
bl1 = x;
bl2 = x+3;
bl3 = x+5;
mbl1 = x.^2;
mbl2 = x.^2+3;
mbl3 = x.^2+5;
figure(3)
subplot(1,2,1);
hold on
plot(bl1)
plot(bl2,'g')
plot(bl3,'m')
title('linear')
subplot(1,2,2);
hold on
plot(mbl1)
plot(mbl2,'g')
plot(mbl3,'m')
title('square')
Any help/explanations would be greatly appreciated!
0 Commenti
Risposta accettata
Kevin Claytor
il 24 Lug 2012
function myfig = makefigure()
% stuff
myfig = figure(3);
% stuff
end
and then
myfig = makefigure();
get(myfig,'Children');
will return the handles to all the subplots.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots 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!