MATLAB: Subscripted assignment dimension mismatch.

MATLABmatlab functionoptimization

I have this error
((Subscripted assignment dimension mismatch))
appear with this function
for i=1:50
f0(i,1)=ofun(x0(i,:));
end
how can i solve this problem?

Best Answer

f0=cell(1,50); %preallocation
for i=1:50
f0{i}=ofun(x0(i,:));
end
celldisp(f0)
Related Question