Passing variable to array name
5 views (last 30 days)
Show older comments
Hi,
I'm currently trying to pass variable N in to the name of an array. The process I'm coding is given below:
for N = 1:totalblocks
Output_{N} = ones(ttotal,cells);
if cells*N < ntotal
cells = cells;
Output_{N} = ones(ttotal,cells);
for j=1:ttotal
path = char(files(j).name);
fprintf('Merging %d of %d, from block %d\n',j-1,ttotal,N);
Output_{N}(j,:) = extractOMF_v1(nx,ny,nz,path,ntotal,N,cells);
end
else
cells = ntotal;
Output_{N} = ones(ttotal,cells);
for j=1:ttotal
path = char(files(j).name);
fprintf('Merging %d of %d, from block %d\n',j-1,ttotal,N);
Output_{N}(j,:) = extractOMF_v1(nx,ny,nz,path,ntotal,N,cells);
end
end
save(strcat('spatially_resolved_',num2str(N),'.txt'),strcat('Output_',num2str(N)),'-ascii')
end
So, let us just consider totalblocks = 1. Then I would like the array 'Output_N' to be named 'Output_1'. This will let me save multiple 'Output' arrays.
When I run this however, the array is simply named 'Output_N'. Does anyone know how I can get 'Output_1' as an output? I get the feeling I'm missing something very obvious!
Many thanks,
Carl
Answers (0)
See Also
Categories
Find more on Logical 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!