MATLAB Answers

Check if Column has Correct Sequence of Numbers

29 views (last 30 days)
I have a column of motion tracking data where there are supposed to only be 3 values (integers) and they should repeat in the same order every 3 rows.
For example, the order is 52630, 1, 2. It repeats ilike that for a few thousand lines.
Once or twice in the column, it will skip one of these values. I need to be able to detect when this happens, and if possible remove the rows from the table where it happens.
For example, if there is a 1 missing in the sequence, I need to be able to delete the rows that containt the 52630 and 2 that are missing the 1 in between them.
I've tried a few different things but none seemed to work as I expected them to.

Accepted Answer

KALYAN ACHARJYA on 25 Feb 2021
Edited: KALYAN ACHARJYA on 25 Feb 2021
1.Create the complete Table with original data (including missing data)
2. use ismissing function to detect in Table
3. Get the rows from the logical matrix of the result of step 2
4. Remove all those rows from the table
Spencer Ferris
Spencer Ferris on 25 Feb 2021
Yes this worked perfectly! Thank you so much!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by