Matlab: adding value into initialized nested struct-cell
I have this structure Data = struct('trials',{},'time',{},'theta_des',{},'vel_des',{},'trials_number',{},'sample_numbers',{}); Data(1).trials = cell(1,trials_number); for i=1:trials_number Data.trials{i} = struct('theta',{},'pos_err',{},'vel',{},'vel_err',{},'f_uparm',{},'f_forearm',{},'m_uparm',{},'m_forearm',{},... 'current',{},'total_current',{},'control_output',{},'feedback',{},'feedforward',{},'kp',{}); end but when I want to add a value Data.trials{i}.theta = 27; I get this error... A dot name structure assignment is illegal when the structure is empty. Use a subscript on the structure.