MATLAB: How to Save a raw array and delete NaN in a raw array

array savedelete nandelete nanananreplace nan with emptysave array

I am using xlsread to get data from .csv files. I need all of the information from these files, so the [raw] = xlsread(thisfile), it what I need to use. However, how would I go about saving this array as a .mat file and replacing any NaN values with empty cells?
I need to use the raw data, unless somebody else knows a way to get all text/numerical data into the array. I tried using textscan, but it was far to complicated.

Best Answer

arr(cellfun(@(x) any(isnan(x)),arr)) = {[]};
Where arr is your input array.