MATLAB: How to deal with this

code generationretag

Hi,
I have a large matrix that is generated in a simulation.
I have noticed that some of the columns are NAN (entire column).
Is there a way to
1) get the number of columns with NAN
2) delete the columns with NAN values
Thanks

Best Answer

find( any(isnan(YourMatrix)) )
and
YourMatrix(:, any(isnan(YourMatrix))) = [];