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

조회 수: 5 (최근 30일)
Canberk Suat Gurel
Canberk Suat Gurel 2021년 6월 28일
편집: dpb 2021년 6월 28일
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?

답변 (1개)

dpb
dpb 2021년 6월 28일
편집: dpb 2021년 6월 28일
tYourTable=tYourTable(contains(tYourTable.frame_id,"map")&contains(tYourTable.child_frame_id,"drone_base"),:);
  댓글 수: 2
Canberk Suat Gurel
Canberk Suat Gurel 2021년 6월 28일
@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 2021년 6월 28일
Yeah -- I had a typo originally and then didn't cut 'n paste enough...
"Do what I mean, not what I say!" :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by