MATLAB: How to name elements in a field of a structure

cellsnaming structures

I have a 1*1 structure with 4 fields. The structure was generated from anova1 so I didn't create it. One field is 33 *2 and I want to name each integer place with a string but I cannot seem to do this. Can anyone help?
Thanks! Kim

Best Answer

A=struct('a',rand(33,2),'b',1,'c',2,'d',3) % your struct array
v=A.a
B.b=A.b
B.c=A.c
B.d=A.d
m=0
for k=1:33
for p=1:2
m=m+1
B.(sprintf('a%d',m))=v(k,p)
end
end