I am looking for a way to remove the NaN numbers from a matrix in MATLAB efficiently (i.e. without using a for loop)
I will provide a quick example to illustrate wha
try my snip function. I wanted to address typical questions like this in one simple function:
snip function
B = snip(A,nan)
you can find the function file at
It also works with all other 'x', '0' or whatever elements and takes care of more similar problems.