removing an entire row

조회 수: 9 (최근 30일)
Daneisha Blair
Daneisha Blair 2021년 8월 31일
댓글: Daneisha Blair 2021년 8월 31일
Hi,
I have array where in column 3 contains names, see attached image. I want to remove the row that is not duplicated in other words has different name, for example grace in the image. The logic approach I want to use to is: if all rows in column 3 are not equal to "fred", then remove that row.
I've tried this approach below, but no success.
a=test(:,3)~=x
if isempty(a)==1
test(find(a==1),:)=[];
end
Note: x="fred" and test is the array
Thank for your help.

채택된 답변

Sean de Wolski
Sean de Wolski 2021년 8월 31일
grace = s(s(:,3)~="fred",:)
  댓글 수: 1
Daneisha Blair
Daneisha Blair 2021년 8월 31일
Thank you Sean, this located the row that contains grace. Now, how can I remove the row (grace) from the s array?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by