so X1 is numeric
AA.SM = []; p = repmat(AA, 3, 1);
so p is a 3 x 1 structure array, each element of which is a struct with field SM
So PN is a scalar stucture array with field PN, and PN.SM is a 3 x 1 structure array, each element of which is a struct with field SM
and now PN is a 100 x 1 structure array, each entry of which has a field named SM, and each of those contains a 3 x 1 structure array, each element of which is a struct with field SM
PN(1) is a single struct array entry with field SM that is a 3 x 1 struct array. PN(1).SM(1) is a single struct array entry, the contents of which is a struct with field SM. And you are trying to assign zeros(1,4) to it instead of a struct.
Best Answer