changing variable names when saving variables
Show older comments
I am running 36 script from one main script. Every "subscript" saves the variables "GUD" and "I2" like in the part I paste here:
if PR==34
run('H34')
end
if PR==35
run('H35')
end
if PR==36
run('H36')
end
save(sprintf('Allv/Alla/HHAG_%02d',PR), 'GUD');
save(sprintf('Allv/Alla/HHAI_%02d',PR), 'I2');
end
What I want is that, when I open the variables I want it to call them a different name for every subscript. Now the variable is called GUD. in G_01, G_02 and so on.
Accepted Answer
More Answers (1)
What I want is that, when I open the variables I want it to call them a different name for every subscript. Now the variable is called GUD
I really wouldn't recommend that. It's not even recommendable that you use load without an output argument. You should be doing things like this,
G=cell(1,N);
for i=1:N
G{i}=getfield( load(file{i}) ,'GUD');
end
Categories
Find more on Matrix Indexing 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!