[scilab-Users] min/max with NaN values
Frederic Jourdin
frederic.jourdin at shom.fr
Wed Nov 24 11:40:44 CET 2010
Hi Mathieu,
OK the use of the hypermatrix works fine.
Thank you very much.
By the way I am gonna report this workaround
in bug 7608.
regards
Fred
Mathieu Dubois wrote:
> Hello Fred,
>
> I agree with you this sounds strange.
>
> If one tries:
> min([1 2 3 %nan])
> the result is 1 as expected.
>
> As a workaround, you can try to stack your matrices in a hypermatrix:
> d=hypermat([2, 2, 3]); // We have 3 2x2 matrices
> d(:, :, 1)=a;
> d(:, :, 2)=b;
> d(:, :, 3)=c;
> min(d, 3)
>
> Alternatively there is a function called nanmean but you cannot use
> the nanmin( a, b, c) syntax.
>
> HTH,
> Mathieu
>
> On 11/24/2010 10:11 AM, Frederic Jourdin wrote:
>> Hi all !
>> if I run this:
>>
>> a= [ 1, %nan; 4, 4];
>> b= [ %nan, 3; 3, 6];
>> c= [ 2, 2; %nan, %nan];
>> min( a, b, c)
>>
>> Scilab returns the following matrix:
>> NaN NaN
>> NaN NaN
>>
>> while the expected matrix should be:
>> 1 2
>> 3 4
>>
>> Why?
>>
>> thanks
>> Fred
>>
>> Scilab 5.3.0.beta3 on Linux
>>
More information about the users
mailing list