If you want to store elements (like strings) that are not the same size you can use cells.
A = {'abc', 'defg', 'hijklmnop', 123, [4,5,6,7,8], false}
A =
'abc' 'defg' 'hijklmnop' [123] [1x5 double] [0]
So if you want to go through a bunch of files and put their content in a cell you can do it this way (pseudo code)
my_list_of_files= {'file1','file2', 'file3'}
my_array = {};
for i=1:length(my_list_of_files)
my_array{i} = read(my_list_of_files{i});
end
2 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/493090-saving-each-data-from-for-loop#comment_771288
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/493090-saving-each-data-from-for-loop#comment_771288
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/493090-saving-each-data-from-for-loop#comment_771367
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/493090-saving-each-data-from-for-loop#comment_771367
Sign in to comment.