help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

find array maximun in matrix


From: shivax
Subject: find array maximun in matrix
Date: Mon, 13 May 2019 12:22:08 -0500 (CDT)

hi, look that:

a=[4 6 1 6  7 9 1 2 3 4]


i want to find maximun series in matrix:

ans: [4 6 6 6 7 9 9 9 9 9]

i can to do this:

maxx=a(1);

for i=2:length(a)
   if a(i)>maxx(i-1) 
     maxx(end+1)=a(i);
  endif
end

but I wanted to write a faster code avoiding the cycle



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]