When I use comma-separated assignment to a structure array to add more data to an existing array, I get an error when I provide an index to specify where in the structure the comma-separated list should be assigned.
For example, executing the following code
s = struct('married', {true false false true});C = {'joe' 'mary' 'jane' 'pete' 36 24 32 54 }';[s(1:4).name, s(1:4).age] = C{1:4,:}
returns this error:
??? Insufficient outputs from right hand side to satisfy comma separated list expansion on left hand side. Missing [] are the most likely cause.
Best Answer