# MATLAB: Why can’t I assign value to a matrix in a loop

arrayfor loopode

tout = [0,2]; %%%output timesu0 = [30;1;30]; %%%initial dataM=zeros(10,3);N=zeros(9,3);y=zeros(9,1);x=zeros(9,1);for i=1:10n=2^i;   %%% the number of equal sized stepstic %%%start timer[t,u] = oderk4(@chemcon,tout,u0,n); %%%run the solvert2=toc; %%%stop timerM(i,:)=u(end,:);end
oderk4 is a function for solving ode, and the output of oderk4 are a vector t and a matrix u. I want to use the last row of every matrix u, so I let M to represent them. However, M doesn't have value after the loop. The workspace shows M is NaN. What's wrong with it?