Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Saving matrix each iteration
Replies: 5   Last Post: Sep 20, 2013 10:35 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: Saving matrix each iteration
Posted: Sep 20, 2013 10:35 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"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




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.