Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Saving matrix each iteration
Posted:
Sep 20, 2013 10:35 AM


"Sincloe Brans" <dickson.f1@gmail.com> wrote in message news:l1gh88$75a$1@newscl01ah.mathworks.com... > Hi Steve, Thanks for the recommendation. The reason I want to convert them > to individual matrices is because I need to calculate the maximum of each > row at later stage. > Right now I use, > [maxValue, rowIdx] = max(C(:,end),[],1); %max value and the row index > to determine the maximum of C=min(A,[],2); How do I do this for each > B{1}... B{j}
C = cell(1, 10); for k = 1:10 C{k} = magic(k+2); end maxRows = cell(1, 10); for k = 1:10 maxRows{k} = max(C{k}, [], 2); end
Since each matrix stored in C has a different number of rows, it doesn't make sense to try to combine all the row maximum vectors into one matrix so I used a second cell array. If they did, you could make maxRows a regular matrix.
 Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com



