help-octave
[Top][All Lists]
Advanced

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

Re: Finding the first element that meets a condition


From: Markus Mützel
Subject: Re: Finding the first element that meets a condition
Date: Tue, 10 Mar 2020 20:21:42 +0100

Am 10. März 2020 um 19:05 Uhr schrieb "Nicholas Jankowski":
> On Tue, Mar 10, 2020 at 2:00 PM Brett Green <address@hidden> wrote:
> 
> If you're avoiding a loop, then by default you're going to be applying some
> operation to the entire array.  Find generally works pretty well.
> 
> >> first_element = find(arr_sorted>min_val)(1)
> ans = 3

Or similarly:
first_element = find(arr_sorted>min_val, 1, 'first')

Markus



reply via email to

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