MATLAB: Vectorization of for/loop

vectorization

I have the following code:
for ii = 1: length(angles)
laminate.ply(ii).angle = angles(ii)/180*pi;
laminate.ply(ii).t = thickness(ii);
laminate.ply(ii).material = mat_ex3_ge();
end
How to impliment it without for/loop?

Best Answer

laminate.ply = struct('angles',num2cell(angles(:)/180*pi),...
't',num2cell(thickness(:)),...
'material',repmat({mat_ex3_ge()},numel(angles),1));
Related Question