[Scilab-users] column vector consisting of the respective minima of every row in a given 2d matrix

Jared Smothermon jareds at aavatech.com
Thu Apr 5 17:54:14 CEST 2018


Heinz,

M=rand(3,2)
min(M,'c')

The 'c' in the min(.) function specifies that you want a column vector, 
which therefore means each element of the vector is found from across 
the rows.

Regards,

jared


On 4/5/2018 9:34 AM, Heinz Nabielek wrote:
> Friends:
>
> a need the column vector consisting of the respective minima of every row in a given 2d matrix. So, I started off
>
> --> M=rand(3,2)
>     0.2113249   0.3303271
>     0.7560439   0.6653811
>     0.0002211   0.6283918
>
>
> --> mean(M,2)
>     0.270826
>     0.7107125
>     0.3143065
>
> THIS LOOKS PERFECT !
>
>
> --> min(M,2)
>     0.2113249   0.3303271
>     0.7560439   0.6653811
>     0.0002211   0.6283918
>
> THIS IS NOT WHAT I WANT !! It gives me the minimum between "2" and the numbers in my 2d matrix.
>
> How do I get the vector consisting of the respective minima of every row in M?
>
> I can do it with a FOR-LOOP, but that would be clumsy......
> Heinz
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users




More information about the users mailing list