How to filter out the table rows not matching the defined criteria?

5 visualizaciones (últimos 30 días)
Canberk Suat Gurel
Canberk Suat Gurel el 28 de Jun. de 2021
Editada: dpb el 28 de Jun. de 2021
I have a table that has multiple columns. See below.
I want to remove the rows that don't satistfy this condition: frame_id != "map" AND child_frame_id != "drone_base".
The remaining array should contain the "x" values of the remaining rows whose frame_id == "map" AND child_frame_id == "drone_base".
How would I go about doing that?

Respuestas (1)

dpb
dpb el 28 de Jun. de 2021
Editada: dpb el 28 de Jun. de 2021
tYourTable=tYourTable(contains(tYourTable.frame_id,"map")&contains(tYourTable.child_frame_id,"drone_base"),:);
  2 comentarios
Canberk Suat Gurel
Canberk Suat Gurel el 28 de Jun. de 2021
@dpb I am receiving this error: Undefined function or variable 'frame_id'.
I can see what you're doing. Shouldn't you use tYourTable.frame_id and tYourTable.child_frame_id to access the content of the two columns?
dpb
dpb el 28 de Jun. de 2021
Yeah -- I had a typo originally and then didn't cut 'n paste enough...
"Do what I mean, not what I say!" :)

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by