Removing row from logical array then restore the remaining dataset
Show older comments
I have a 3047 x 19 table and I need to remove outliers from them. I found the outliers and now I have a 3047 x 19 logical array, where 1 is an outlier and 0 is non-outliers. How do I remove the rows containing the outliers and restore the logical array into a table back?
1 Comment
Jeffrey Clark
on 20 Apr 2022
Use 'any' to get from 3047x19 to a 3047x1 logical vector. Then use the logical vector to index the rows of the table to delete, like this: myTable(myVector,:) = [];
Answers (1)
keeprows=~any(outliers,2);
myTable=myTable(keeprows,:);
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!