Deleting multiple rows if they satisfy two conditions
9 views (last 30 days)
Show older comments
Hi all,
I have a massive table (37200 x 22) and i need to remove rows that meet two conditions.
I would like a (relatively) simple way to delete all rows where tmin and tmax (the columns) are equal to 0.
2 Comments
Walter Roberson
on 16 May 2023
- == is used for comparison, except inside the hidden internal symbolic computer language
- = is primarily used for assignment
- inside a () list of parameters to a function, WORD=VALUE can be used to substitute for 'WORD', VALUE name/value pairs.
Accepted Answer
Walter Roberson
on 16 May 2023
mask = MassiveTable.tmin == 0 & MassiveTable.tmax == 0;
MassiveTable(mask,:) = [];
2 Comments
Walter Roberson
on 16 May 2023
mask = YourTableNameGoesHere.tmin == 0 & YourTableNameGoesHere.tmax == 0;
YourTableNameGoesHere(mask,:) = [];
More Answers (0)
See Also
Categories
Find more on Logical 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!