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: maximum values in loops for 2d matrix
Replies: 4   Last Post: Aug 20, 2014 2:06 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Manolis Micailidis

Posts: 4
Registered: 8/19/14
maximum values in loops for 2d matrix
Posted: Aug 19, 2014 6:43 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

hello, i need for some defined times N=5 (i used while loop) ,to find the maximum values in a 2d matrix and save them each time so that the old max values not to be calculated again in the second repeat (for instance N=2). So i thought that i might need to delete the old max values before calculating the new ones , but having previously save them to a new matrix. Below i quote the code please take a look and advise ,thanks in advance.

while(N<=5)

[rows,cols]=size(Sf);

for i1=1:cols
maximum(i1)=Sf(1,1);
for j1=1:rows
if Sf(j1,i1)>maximum(i1)
%%max(Sf,[],1)
maximum(i1)=Sf(j1,i1);
%%max_rows=max(Sf);
%%max_columns=max(max_rows);
end

end

end
N=N+1;
end



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.