MATLAB: Replace one NAN with zero in a row vector without a loop

isnan

I have a row vector that its size is changing in each run. Some of its elements might be NAN and I want to replace those with zero.
How can I do that without need to have a loop? isnan(A) finds nan values but I need to replace and I want to avoid loop.

Best Answer

A(isnan(A)) = 0; % replaces NAN elements of A matrix by Zero.