MATLAB: Matrix turning nans to 1

nan

Hi all, I have a 294×1 matrix, and I want to convert all the NaNs to 1.
If anybody could assist me I would be grateful.
Thanky ou.

Best Answer

Let M be your matrix.
M(isnan(M))=1;