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

Heinz Nabielek heinznabielek at me.com
Thu Apr 5 19:06:30 CEST 2018


Coming from FORTRAN snd C, the 'c' notation is strange. But great, if it works.....

Sent from Heinz Nabielek

> On 05 Apr 2018, at 17:54, Jared Smothermon <jareds at aavatech.com> wrote:
> 
> 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
> 
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users



More information about the users mailing list