From: Jonathan on
Good morning,

I have the following matrix:
a =[ 3 1 3 2
9 3 4 2
NaN 8 1 12
10 1 99 2];

What I would like to do is where there are NaNs identified in the first column, values in the same rows but in the other columns are replaced with NaN values so the final matrix looks like:
a =[ 3 1 3 2
9 3 4 2
NaN NaN NaN NaN
10 1 99 2];

Any thoughts on how to do this.

Thanks
Jon
From: Matt Fig on
a(isnan(a(:,1)),:) = NaN
From: Jonathan on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <hshakb$1ih$1(a)fred.mathworks.com>...
> a(isnan(a(:,1)),:) = NaN

Thanks Matt, I figured out another way using Find but ypir approach is more elegant.

Cheers
Jon