Delete NAN + following x values
이전 댓글 표시
I have a matrix containing instrument data. Every, lets say, 20 minutes it has a baseline, recorded as NAN followed by some "flushing" values (not useful data). Is there a way I can program Matlab to do something like "find the first NAN of a sequence and delete the next 70 rows? Thank you so much in advance.
답변 (1개)
A = rand(10,3) ; % some random data
A(7,:) = NaN ; % introduce NaN
idx = find(isnan(A)) ; % find the positions of NaN's
% first row where Nan occurs
row1 = idx(1) ;
% remove the rows
A(row1:end,:) = []
카테고리
도움말 센터 및 File Exchange에서 NaNs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!