Info
この質問は閉じられています。 編集または回答するには再度開いてください。
how to store every element of a cell array in a separate folders
1 回表示 (過去 30 日間)
古いコメントを表示
Hello everyone,
I'm kind of newto matlab, and I have a problem in assigning and storing data to subfolders. I have one folder let say newfolder, and I created 6 subfolders based on the sizee of cell array. Now I want to save every elemnt of cell to subfolders in order but automatically. in the following is my code and I was wondering how to make use of for loop to make it automatic iteration. That is because it is going to be much more cell argumanet later for example 50 to 100.
here is the code
n = 1;
folder = 'C:\Users\HSH\Desktop\MATLABCOURSE\simulation_Data1';
fileName = fullfile(folder, sprintf('image_%d.png', n));
imwrite( adj_level2{1,n}, fileName);
folder = 'C:\Users\HSH\Desktop\MATLABCOURSE\simulation_Data2';
n1=n+1;
fileName = fullfile(folder, sprintf('image_%d.png', n1));
imwrite( adj_level2{1,n1}, fileName);
folder = 'C:\Users\HSH\Desktop\MATLABCOURSE\simulation_Data3';
n2=n1+1;
fileName = fullfile(folder, sprintf('image_%d.png', n2));
imwrite( adj_level2{1,n2}, fileName);
folder = 'C:\Users\HSH\Desktop\MATLABCOURSE\simulation_Data4';
n3=n2+1;
fileName = fullfile(folder, sprintf('image_%d.png', n3));
imwrite( adj_level2{1,n3}, fileName);
folder = 'C:\Users\HSH\Desktop\MATLABCOURSE\simulation_Data5';
n4=n3+1;
fileName = fullfile(folder, sprintf('image_%d.png', n4));
imwrite( adj_level2{1,n4}, fileName);
folder = 'C:\Users\HSH\Desktop\MATLABCOURSE\simulation_Data6';
n5=n4+1;
fileName = fullfile(folder, sprintf('image_%d.png', n5));
imwrite( adj_level2{1,n5}, fileName);
more accurately I dont know how to assign n to simulation_Data (name of subfolders). Any help would be deeply appreciated. Regards
0 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!