find common elements from cell array and remove it

I have two cell arrays A and B
A={1,2,3,4}
B={2,3}
remove elements from A that is present in cell array B
and answer should be
{1,4}

 採用された回答

Andrei Bobrov
Andrei Bobrov 2019 年 12 月 30 日

0 投票

out = A(~ismember([A{:}],[B{:}]));

2 件のコメント

Bhaskar R
Bhaskar R 2019 年 12 月 30 日
If
B={1,2,3,4};
A={2,3};
out = A(~ismember([A{:}],[B{:}])); %?
Niharika  Nayak
Niharika Nayak 2019 年 12 月 31 日
Thanks it works

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by