How to save variables in a loop by changing the names
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have the following problem :
- I generate big 3D arrays on a powerful computer.
- I want to use these arrays on a computer with much less memory.
The solution I've come up with is to divide my big array in small arrays and save them to a mat file. For exemple :
In file named 'toto', I would have 'array_1', 'array_2'...'array_N'
I have tried something lile :
for i=1:N
array_i= array(:,:,i); %array is the big 3D array
save('toto','array_i','-append');
end
But it obviously doesn't work since 'array_i' won't change at each loop.
Any idea?
Thank you
0 个评论
采纳的回答
Walter Roberson
2013-8-14
2 个评论
Iain
2013-8-20
There's a few good reasons to avoid doing it in that way.
You may be better off by writing a binary file.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!