removing an entire row

4 ビュー (過去 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 Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by