I'm trying to parse a vector with NaN, into a cell array that is delineated by the start and stop of the NaN
example = [1 2 3 Na Na 2 3 Na 4 5 6 7 Na Na Na Na 1];
and turn that into
answer = {[1 2 3] [2 3] [4 5 6 7] [1]}
any suggestions? I've been using find(isnan(example)) to get the indices of NaN, but what I really need are the stop and stop indices of the non – NaN segments
Thanks!
Best Answer