delete NaN values from Matrix & use Matrix for other operations
Show older comments
hey guys, I hope y'all can help me out with some awesome codes. Here is what I'm trying to do:
I have two 17759x1 double matrices, which I want to plot in order to analyze correlation. But both have some NaN values which I want to delete (shorten the matrices). In addition, one matrix sometimes has the value 9999, which I want to delete as well. I get stuck here already. The next part might be even more tricky, because the values have a time-dependency, meaning that if I delete one value(row) in one matrix I have to delete the same row(index) in the other Matrix as well, in order to plot them correctly in the end. Thanks in advance !
Accepted Answer
More Answers (1)
Walter Roberson
on 12 Mar 2021
Edited: Walter Roberson
on 12 Mar 2021
discards = 9999; %could be vector of values
mask = isnan(First) | isnan(Last) | ismember(First, discards) | ismember(Second, discards);
selectedFirst = First(~mask);
selectedSecond = Second(~mask);
selectedTimes = Times(~mask);
Categories
Find more on Interpolation of 2-D Selections in 3-D Grids in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!