From: Assaf Weinstein on 4 Jul 2010 05:32 Hi, I have a vector t which contains either numerical values or NaNs. I want to take out all NaNs, ie, t=t("~NaN"); Is there a syntax to do this? (i can do this with t=t(t>=0 or t<0), i guess, but wonder if there is a direct way to obtain it..) Thanks asaf
From: us on 4 Jul 2010 05:48 "Assaf Weinstein" <assafweinstein_remove.this(a)gmail.com> wrote in message <i0pkek$al9$1(a)fred.mathworks.com>... > Hi, > > I have a vector t which contains either numerical values or NaNs. I want to take out all NaNs, ie, t=t("~NaN"); Is there a syntax to do this? (i can do this with t=t(t>=0 or t<0), i guess, but wonder if there is a direct way to obtain it..) > > Thanks > > asaf well... you got it almost right... one of the solutions v=[1,nan,2,nan]; r=v(~isnan(v)) % r = 1 2 % -or- r=v(v==v) us
From: Assaf Weinstein on 4 Jul 2010 08:41 "us " <us(a)neurol.unizh.ch> wrote in message <i0plcl$9sc$1(a)fred.mathworks.com>... > "Assaf Weinstein" <assafweinstein_remove.this(a)gmail.com> wrote in message <i0pkek$al9$1(a)fred.mathworks.com>... > > Hi, > > > > I have a vector t which contains either numerical values or NaNs. I want to take out all NaNs, ie, t=t("~NaN"); Is there a syntax to do this? (i can do this with t=t(t>=0 or t<0), i guess, but wonder if there is a direct way to obtain it..) > > > > Thanks > > > > asaf > > well... you got it almost right... > > one of the solutions > > v=[1,nan,2,nan]; > r=v(~isnan(v)) > % r = 1 2 > % -or- > r=v(v==v) > > us --Great, exactly what i was looking for... Thank you, Asaf
|
Pages: 1 Prev: marking a specific point in matlab plot. Next: Matrices in if statements |