Hi all
I have some data in the form of structures, eg strA, strB e.t.c. All structures have the same fields, let's say f1 and f2. I want to create the same new fields in every structure, for example:
strA.mean = mean(strA.f1);strA.std = std(strA.f1);
Is there a way to do this with a loop so I don't have to write the above two lines of code for each structure? I tried the following but it doesn't work:
structnames = {'strA','strB','strC','strD','strF','strG','strK'}n = length(structnames)for i = 1:n structnames{i}.mean = mean(structnames{i}.f1); structnames{i}.std = std(structnames{i}.f1);end
Any ideas?
Best Answer