Search All of the Math Forum:

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

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

Topic: maximum values in loops for 2d matrix
Replies: 4   Last Post: Aug 20, 2014 2:06 PM

 Messages: [ Previous | Next ]
 Manolis Micailidis Posts: 56 Registered: 8/19/14
maximum values in loops for 2d matrix
Posted: Aug 19, 2014 6:43 AM

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

Date Subject Author
8/19/14 Manolis Micailidis
8/19/14 Manolis Micailidis
8/20/14 Manolis Micailidis
8/20/14 Steven Lord
8/20/14 Manolis Micailidis