I have a structure with sample
being a numeric vector. I would like to replace the numbers in sample
by sample/2
. However, I do not know how to overcome the following error:
Scalar structure required for this assignment.
Any suggestions are more than welcome.
Example:
field1 = 'event';
value1 = {'A', 'B', 'C', 'D'};
field2 = 'sample';
value2 = 22;
A = struct(field1, value1, field2, value2);
What I want to do:
A.sample = round([A.sample]/2,0);