Greetings all:
So I have three structs named method1, method2, and method3. I also have a cell array (named structNames) that contains the name of the structs. The problem is that I get an error (that reads "Struct contents reference from a non-struct array object") when I try to extract the content of the structs in a for loop. Is there a way around this: Here is a sample code:
structNames = {method1,method2,method3};method1.mean = 3;method2.mean = 4;method3.mean = 5;meanSum = 0;for m = 1:length(structNames)meanExtract = structNames{m}.mean;meanSum = meanSum + meanExtract;end
Best Answer