[scilab-Users] min/max with NaN values
Mathieu Dubois
mathieu.dubois at limsi.fr
Wed Nov 24 11:13:16 CET 2010
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