Concatenate array
ID | CC-16 |
Title | Do not use brackets to concatenate struct array field values or object array property values. |
Priority | Mandatory |
Severity level | 3 |
Description | Performing concatenation on an expanded array is not supported by the Coder before MATLAB R2020b. |
Rationale | Compatibility |
Avoid:
a = [myStruct(:).b];
Instead use:
len = numel(myStruct);
a = zeros(len);
for iMyStruct = 1:len
a(iMyStruct) = myStruct(iMyStruct).b;
end