Hey people. I have a huge dataset which looks as follows
x y z p 2 4 1 20 2 4 2 1 2 4 3 NaN 2 4 4 NaN 2 4 5 NaN 3 5 1 5 3 5 2 1 3 5 3 52 3 5 4 22 3 5 5 NaN 6 3 1 10 6 3 2 4 6 3 3 1 6 3 4 NaN 6 3 5 NaN (...)
As u see the dataset is sorted according to the first three columns. I would like to extract only the lines/rows which are directly above the NaN. I find a way to remove all the lines containing a NaN by using an index.
p(isnan(p))= -999;index = 1:size(p,1);index = index(p > -999);x = x(index);y = y(index);z = z(index);p = p(index);
But I have not really a clue how to remove the remaining lines. Does someone have an idea/hint?
so the solution for the example would be:
2 4 2 1 3 5 4 22 6 3 3 1
Thanks in advance! P
Best Answer