MATLAB: How to create a structure

celldoublestructstructures

i want to create a structure with these dimensions: A: 20*1 cell, B: 20*1 double, C: 20*1 double, D: 20*1 double, E: 20*1 double, F: 20*1 double. please help me.thank you.

Best Answer

YourStruct = struct('A', {cell(20,1)}, 'B', {zeros(20,1)}, 'C', {zeros(20,1)}, 'D', {zeros(20,1)}, 'E', {zeros(20,1)}, 'F', {zeros(20,1)});
Or if you prefer,
YourStruct.A = cell(20,1);
for FN = 'BCDEF'
YourStruct.(FN) = zeros(20,1);
end