[Top][All Lists]

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

Re: Indexing question

From: Mirek Kwasniak
Subject: Re: Indexing question
Date: Wed, 28 Nov 2001 17:15:14 +0100
User-agent: Mutt/1.3.23i

On Mon, Nov 26, 2001 at 11:46:34PM -0300, Roberto Hernandez wrote:
> When I need to find the first element in a vector that meets a certain 
> condition I use a combination of "find" and "min".
> If I need the first element that is > 20:
> min(find(a > 20))

There isn't a function for this task :(

My solution is without "min" function

i=find(a > 20); i=i(1);


Note for developers: 

  Maybe it is worth to expand "find" to two arguments version, where second
  argument is a selector vector. For big size of first argument you can get
  less computation time and have lower memory usage.

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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