plotting on multi figures

I plot data to a figure using a function i have created(using code generation):
function createPlot(x1, y1, title)
figure1 = figure;
% Create axes
axes1 = axes('Parent',figure1,'YGrid','on','XGrid','on');
box(axes1,'on');
hold(axes1,'all');
% Create plot
plot(x1,y1,'LineWidth',2,'DisplayName','y1 vs. x1');
% Create textbox
annotation(figure1,'textbox',...
[0.170811320754717 0.777089783281734 0.237993710691824 0.111455108359134],...
'Interpreter','none',...
'String',{title},...
'FontSize',12,...
'FitBoxToText','off',...
'LineStyle','none',...
'Color',[1 0 0]);
I now write a script to run this for all files in a folder. How can i make each call of the createPlot function above to plot on a different figure

 Réponse acceptée

Sean de Wolski
Sean de Wolski le 11 Mai 2011

0 votes

It should be opening a new figure each time you call it because of the 2nd line:
figure;
?
So just call it multiple times.

Plus de réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by