help-octave
[Top][All Lists]
Advanced

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

RE: how to get the element >0 in array


From: Windhorn, Allen E [ACIM/LSA/MKT]
Subject: RE: how to get the element >0 in array
Date: Wed, 18 Jul 2018 13:31:18 +0000

> -----Original Message-----
> From: Help-octave [mailto:help-octave-
> address@hidden On Behalf Of turbofib
> 
> i've the following array:
> 
> a=[-3 -5 0 5 4]
> 
> i want to loop it until i find element>0 (5)
> 
> can I loop it but is there a faster method?

>> a=[-3 -5 0 5 4]
a =  -3  -5   0   5   4

>> a(a>0)
ans =

   5   4

>> a(a>0)(1)
ans =  5

Regards,
Allen



reply via email to

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