Help reduce number of rows by grouping continous data

2 views (last 30 days)
Hello,
as seen in the attached image, does anyone know how I can reduce the number of rows by grouping the first and last number of data that are squential. Ex) the first cell should say 20390-20400 because thats the first and last point in which continous data by differnce of 1 is present. the second row should say 22579-22588, then third row should say 25895-25904.
Thanks

Accepted Answer

David Hill
David Hill on 29 Nov 2022
d=find(diff(yourData)>1);
m=[yourData(1),yourData(d(1))];
for k=2:length(d)
m(k,:)=[yourData(d(k-1)+1),yourData(d(k))];%generate matrix with beginning to end of each stream
end
m(end+1,:)=[yourData(d(end)+1),yourData(end)]

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!