The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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: 18,038
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" <> wrote in message
> 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);
maxRows = cell(1, 10);
for k = 1:10
maxRows{k} = max(C{k}, [], 2);

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

Steve Lord
To contact Technical Support use the Contact Us link on

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.