Removing row from logical array then restore the remaining dataset

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

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,:) = [];

Sign in to comment.

Answers (1)

keeprows=~any(outliers,2);
myTable=myTable(keeprows,:);

Categories

Tags

Asked:

on 20 Apr 2022

Edited:

on 20 Apr 2022

Community Treasure Hunt

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

Start Hunting!