deleting NaNs in a column without changing the size of the matrix
6 views (last 30 days)
I used this script to delete a few NaN s I have in column 5 of a file, However, the size of the matrix changed too. How should I change the edit the script to keep the size of the matrix the same?
dataEEG(isnan(dataEEG(:,5)),:) = ;
Image Analyst on 20 Jan 2019
No you can't. If you delete the rows, the matrix will shrink. What you can do is to either set the nan elements to some known, constant value, or to fill in the nan regions with data from surrounding regions with something like regionfill() or a modified median filter. Would you like to do that? With regionfill() there is no max region size to fill in, but for a modified median filter you'd have to know the largest size of nan region in advance, which you can find.