I'm having this error but I don't understand why. I'm creating a structure of size 3x4x4 with 6 fields within loops. Then, I would like to create two more fields for the whole structure. How can I do it?
for i = 1:N
for j=1:length(Cr)
for m=1:length(TR)
for k=1:length(pH)
form(j,m,k).name = ["c" num2str(Cr(j)) "TR" num2str(TR(m)) "ph" num2str(pH(k))];
form(j,m,k).Cr = Cr(j);
form(j,m,k).Ct = Cr(j)*TR(m); % corde tip
form(j,m,k).S = (form(j,m,k).Cr+form(j,m,k).Ct)*H/2;
form(j,m,k).AR = H^2./form(j,m,k).S;
if (pH(k) == 0)
form(j,m,k).c(i) = form(j,m,k).Ct*cos(phi(i))+form(j,m,k).Cr*(1-cos(phi(i)));
elseif (yh(i) < H*pH(k))
form(j,m,k).c(i) = form(j,m,k).Cr;
else
form(j,m,k).c(i) = form(j,m,k).Cr+(form(j,m,k).Ct-form(j,m,k).Cr)/(H-pH(k)*H)*(yh(i)-pH(k)*H);
endif
end
end
end
end
form.c_top = form.c(N/2+1:end);
form.c_bot = form.c(1:N/2);
I would like that form(x,y,z).c_top = form(x,y,z).c(N/2+1:end), and this for the whole structure.
endif
is not valid MATLAB syntax, it would be best if you tagged your question for the specific language you're using to get answers you can definitely use.