min Into range Array

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

min Into range Array

turbofib
look that:

a=[ 3  1 8 2; 5  7 8 3;7 8 9 6;0 2 6 1]

i need to search min between 2 index

example:



min between position 2 and 4 element

RIS=1 3 6 1  (1 is min between 1 8 2, 3 is min between  7 8 3, 6 is min
between 8 9 6....

it's possible to do this avoid loop?

thank very
 



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


Reply | Threaded
Open this post in threaded view
|

Re: min Into range Array

Pantxo
turbofib wrote

> look that:
>
> a=[ 3  1 8 2; 5  7 8 3;7 8 9 6;0 2 6 1]
>
> i need to search min between 2 index
>
> example:
>
>
>
> min between position 2 and 4 element
>
> RIS=1 3 6 1  (1 is min between 1 8 2, 3 is min between  7 8 3, 6 is min
> between 8 9 6....
>
> it's possible to do this avoid loop?
>
> thank very
>  
>
>
>
> --
> Sent from:
> http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

Hi,

a=[ 3  1 8 2; 5  7 8 3;7 8 9 6;0 2 6 1];
b = min (a(:,2:end), [], 2)

Pantxo



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