I use MATLAB 2011. Related to the questions I asked yesterday. How to save plots and work space to a folder automatically that come in a loop.
1 回表示 (過去 30 日間)
古いコメントを表示
I have about 900 data sets to be analysed and that can be done with single program. Using a loop for d=1:900 I'm able to do that. for d=1 the first data set is analysed and I get about 5 plots and a work space. Similarly for d=2 till d=900. I want to know if there is a code which saves the plots and work spaces to a folder after executing the program for each data set i.e., for each d=integer a separate folder having corresponding plots and work spaces. If it is possible also suggest me a way to name those folders differently so that they don't get replaced because of having the same name.
0 件のコメント
採用された回答
Iain
2013 年 6 月 6 日
for i = 1:n
... code
filename = [somepath '\' somefilename num2str(i) '.png'];
saveas(figure,filename)
filename = [somepath '\' somefilename num2str(i) '.mat'];
save(filename)
end
4 件のコメント
Iain
2013 年 6 月 7 日
My bad - its the figure handle you need to give to saveas
fig_no = figure;
h = plot(...
saveas(fig_no,filename)
その他の回答 (1 件)
David Sanchez
2013 年 6 月 6 日
for k = 1:900
filename = strcat('my_fig_',num2str(k));
h = figure; % figure handle
plot(a,b); % your data
print(h, '-dbmp', filename);
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!