For Programmers: Free Programming Magazines  


Home > Archive > Matlab > June 2007 > NaN replace by zero









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author NaN replace by zero
Le

2007-06-29, 8:13 am

Hi,

Is it possible to replace "NaN" to zero (0)? For example, X = [ 1, 2,
,3] and when MatLab reads : X = 1 2 NaN 3. So, the "NaN" in this
matrix, is it possible to replace by 0? Which gives to X = [1, 2, 0,
3].

Thanks,

Le
per isakson

2007-06-29, 8:13 am

Le wrote:
>
>
> Hi,
>
> Is it possible to replace "NaN" to zero (0)? For example, X = [ 1,
> 2,
> ,3] and when MatLab reads : X = 1 2 NaN 3. So, the "NaN" in this
> matrix, is it possible to replace by 0? Which gives to X = [1, 2,
> 0,
> 3].
>
> Thanks,
>
> Le


X(isnan(X))=0;

/ per
Le

2007-06-29, 7:14 pm

Thanks, ;)

Le
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com