Reputation: 4807
I have a for loop where I do something like:
figno = 1;
for i = 1:50
h = figure( figno );
figno = figno + 1;
plot( x, y, '-.ob' );
grid on;
xlim([1,12]);
legend( 'x', 'y' );
ylabel( 'Value' );
title( 'Figure Title' );
end
handles = findall( 0, 'type', 'figure' );
Fig2PDF( 'MyFile.PDF', numel( handles ) );
Where the function Fig2PDF is a function which reads the number of handles and looks up for all open figures and converts it to one PDF file.
But the server gives error due to 50 open windows. I was wondering whether it is possible to do the above without opening the figure window.
Upvotes: 1
Views: 74
Reputation: 58
You can try setting the figure visibility to off. Shown here:
for i = 1:50
h = figure(i);
set(h,'Visible','off');
plot(x, y,'-.ob');
grid on;
xlim([1,12]);
legend('x','y');
ylabel('Value');
title('Figure Title');
end
handles = findall(0, 'type', 'figure');
Fig2PDF('MyFile.PDF', numel(handles));
Upvotes: 2