How can I save .mat files inside a for loop without overlapping?
2 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
KSSV
2017 年 5 月 22 日
Why you want to generate multiple .mat files? Check the below two case. You can write all the matrices into a single mat file.
%%If matrices sizes are equal
m = 10 ; n = 9 ; p = 10 ;
A = zeros(m,n,p) ;
for i = 1:p
A(:,:,i) = rand(m,n);
end
save('test.mat','A');
%%if mat4rices sizes are not equal
A = cell(p,1) ;
for i = 1:p
m = randi([1 10],1) ;
n = randi([1 10],1) ;
A{i} = rand(m,n) ;
end
save('test.mat','A');
1 件のコメント
KSSV
2017 年 5 月 22 日
Vio Bas Commented:
Thank you very much for your question, that was very helpful. It was exactly what I was looking for! Much more efficient than having a huge amount of .mat files. :D
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で File Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!