Operations in structure with N fields named sequencially.
2 views (last 30 days)
I created this structure (S) with 26 fields named sequencially. Each field has only one column and N number of rows (e.g. S.myfield1 (65x1), S.myfield2 (70x1), and so on). I just want to get the mean of S (all the fields).
Error using sum
Invalid data type. First argument must be numeric or logical.
Error in mean (line 127)
y = sum(x, dim, flag) ./ mysize(x,dim);
So I transformed the structure into cell (struc2cell). I can get the mean of each cell (e.g. each field in the structure) but I cannot get the mean of two cells:
Error using mean
Too many input arguments.
Also, I am interested in getting the min , max and std of S.
I could not find any page with this info regarding structure operations. Any solution?
I am looking that my structure is different as normal structure.
I load a -mat file containing 26 variables as
So, my structure is 1x1 with 26 fields. The Field is the name of each variable and the value of each field is the number of rows X number of columns (1)