Saving pdf's inside loop

1 回表示 (過去 30 日間)
Jules Ray
Jules Ray 2014 年 9 月 20 日
編集済み: Jules Ray 2014 年 9 月 21 日
Hello guys:
i have a script to create subplots, and divide them into different pages, however i'm unable to save these pages as pdf inside the loop, here is the code:
station='CONT';
ps=8;% plots per page
np=nim; %number of plots
for it=1:np
xt=rem(it-1,ps)+1;
if xt==1
figure;
end
ax1=subplot(4,2,xt);
xlim(Xll(it,:)); %xlimits, come from figure structure
ylim(Yll(it,:)); %ylimits, come from figure structure
copyobj(allchild(get(h1(it),'CurrentAxes')),ax1);
%check this is NOT WORKING ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
fout = sprintf('%s_DR_%u.pdf',station,idx);
saveas(gcf,fout,'pdf');
end
thanxs in advance for any idea

回答 (1 件)

Jan
Jan 2014 年 9 月 21 日
"NOT WORKING" is not useful to explain what happens. Do you get an error message? Perhaps this message contains the information that the variable "idx" is not defined? Perhaps you want "it" to appear inside the name of the file?
  1 件のコメント
Jules Ray
Jules Ray 2014 年 9 月 21 日
編集済み: Jules Ray 2014 年 9 月 21 日
no, instead of save one pdf for each subplot, just save twice the last subplot.... the question is where to put the saveas line to get one pdf for each loop...

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by