Clear Filters
Clear Filters

Delete zero rows from a table

32 views (last 30 days)
Jian Teng
Jian Teng on 25 Jun 2018
Commented: Paolo on 26 Jun 2018
I have a table in MatLAB. The table has two column, one is called direction, another one is call speed. There are many zeros in the speed column. I would like to delete the row that has 0 in speed. Could anyone help me with that? Thanks!

Accepted Answer

Paolo
Paolo on 25 Jun 2018
Edited: Paolo on 26 Jun 2018
For a table named t:
t(~t.speed,:) = []
  3 Comments
Jian Teng
Jian Teng on 26 Jun 2018
what is ~ mean?
Paolo
Paolo on 26 Jun 2018
Tilde is the logical NOT operator. ~t.speed is used to find all the rows where t.speed is equal to zero. You can find more information on logical operators in the documentation (link).

Sign in to comment.

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!