how to save matrix with the index of matrix name increase in every loop?

1 回表示 (過去 30 日間)
UTA
UTA 2013 年 4 月 17 日
As I ask above, I want to use 'save' function to save the data in .mat format. However, I want to save the data ,which comes from loop, with the name can shown it comes from the number of the loop. part of the code as follow:
for i=1:10
is=num2str(i);
filename=['image' is '.png'];
I=im2double(imread(filename));
imshow(I,[])
[x,y] = ginput(n);
end
here I want to save [x,y] comes from each loop with the name of 'click_points_1 'to 'click_points_10'. How can I do that? thank you very much!

採用された回答

Walter Roberson
Walter Roberson 2013 年 4 月 17 日
matfilename = sprintf('click_points_%d.mat', i);
save(matfilename, 'x', 'y');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by