help-octave
[Top][All Lists]
Advanced

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

AW: Finding the index of the smallest value in a vector


From: Ploett Norbert
Subject: AW: Finding the index of the smallest value in a vector
Date: Thu, 18 Nov 2004 09:29:43 +0100

Soren,

I found an even better answer myself - just did not come to think of trying
"help min":
min can be called with two output parameters:

[x, ix] = min ([1, 3, 0, 2, 5])

the second is the index i am looking for.

Thanks and bye,


Norbert

-----Ursprüngliche Nachricht-----
Von: Soren Hauberg [mailto:address@hidden
Gesendet: Donnerstag, 18. November 2004 09:24
An: Ploett Norbert
Cc: address@hidden
Betreff: Re: Finding the index of the smallest value in a vector


Hi,
If I understand you correctly you should be able to use find:

find( vector == min(vector) )

/Soren

Ploett Norbert wrote:
> Hello all,
> 
> I need to find a function that returns the index of the smallest value in
a
> vector. How do I go about this? I.e. is there a handy function that I do
not
> know of?
> 
> find() does not seem to do exactly what I want.
> 
> Tnx,
> 
> 
> Norbert
> 
> 
> 
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
> 
> 



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

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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