Saving variables and figures uniquely when processing a sequence of files
1 回表示 (過去 30 日間)
古いコメントを表示
I am trying to save a variable (A) with the num2str(k)so that I can run multiple files at once, but keep getting an error.
example: hgsave('SummaryPlot' num2str(ii)); and hgsave('SummaryPlot' num2str(ii),'.txt');
If there a better way to do this?
0 件のコメント
採用された回答
Kye Taylor
2013 年 2 月 15 日
編集済み: Kye Taylor
2013 年 2 月 15 日
try
hgsave(['SummaryPlot',num2str(ii)]);
notice the square brackets in order to concatenate 'SummaryPlot' and the output from num2str(ii). Same with
hgsave(['SummaryPlot',num2str(ii),'.txt']);
0 件のコメント
その他の回答 (1 件)
Image Analyst
2013 年 2 月 15 日
編集済み: Image Analyst
2013 年 2 月 15 日
If you're familiar with C, you'll probably prefer the sprintf() way:
baseFileName = sprintf('Summary Plot %d.txt' ii);
fullFileName = fullfile(yourFolder, baseFileName);
hgsave(fullFileName);
yourFolder could be "pwd" - the current folder - if you wish. Also, please consider export_fig instead of hgsave: http://www.mathworks.com/matlabcentral/fileexchange/index?sort=downloads_desc&term=
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!