Matlab - How to concat dataset name + i in for loop? -


i have dataset containing several arrays identified generic name , number. modify arrays independently each other in loop so:

for i=1:length(dataset)  dataset.genericname_i(row,column)=f(x) end 

do know way that?

thanks!

unless misunderstood looks dynamic field referencing.

you (using k instead of i loop counter...try avoid using either i or j purpose):

for k=1:length(dataset)     name = sprintf('genericname_%i',k);     %// note use of brackets create dynamic field    dataset.(name) =f(x);  end 

is meant?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -