How can i delete cell from cell array?

I have two cell array,
W =
1×2 cell array
[1×2 double] [1×2 double]
F =
3×2 cell array
[1×2 double] []
[1×2 double] [1×2 double]
[1×2 double] []
I want to check if cell value in F contains in W, then I will delete the cell value in W
please help me.

댓글 수: 4

Adam Danz
Adam Danz 2019년 12월 15일
Do you mean if the entire vector in F{n} matches a vector in W or if a single element within F{n} matches any element in W?
Providing a complete example would probably clear that up.
Mira le
Mira le 2019년 12월 15일
I mean
each element F{n} matches any element in W
Adam Danz
Adam Danz 2019년 12월 15일
편집: Adam Danz 2019년 12월 15일
So if F{n} equals [4,8] and W{m} equals [5,8] you want to remove the 8 in W{m}, is the correct? The final result would be W{m}=[5]. (That's what a complete example would look like).
Image Analyst
Image Analyst 2019년 12월 15일
You might try ismember() with the rows option. Or try a loop comparing W with each row of F with isequal(). Please attach the actual F and W in a .mat file with the paper clip icon.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2017a

질문:

2019년 12월 15일

댓글:

2019년 12월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by