save the variables whose names are always changing over different loops
Show older comments
Consider the example below. The aim is , in every circulation, to generate a variable first, only a1 in the fist circulation for example,then save the generated variable into hardware, then the workspace should be cleared right before each circulation ends considering the huge size of the data. What I can do now is only to generate the desired variable in the workspace, and I am at a loss on how to save it to the hard disk automatically .
for i=1:10;
name=['a',num2str(i)];
eval([name,'=',num2str(i^2),';']);
%-------
% PLEASE help add a line or more here to save ai into hard disk
%-------
clear all
clc
end
Thanks a million
Accepted Answer
More Answers (1)
Sean de Wolski
on 8 Jul 2011
2 votes
Don't do this!!!
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!