필터 지우기
필터 지우기

how to delete a element out of cell?

조회 수: 1 (최근 30일)
ha ha
ha ha 2017년 12월 15일
답변: Walter Roberson 2017년 12월 15일
Let's say:
A : 1x3 cell class
A={cell_1, cell_2, cell_3, }
A={[2x1 double],[5x1 double],[3x1 double]}
cell_1 [999;222]
cell_2 [444;123;2000;789;1000]
cell_3 [5000;9000;4000]
I also have matrix:
B=[1000;2000;4000;5000]
Question: How to delete matrix B out of cell A? Let's say:
result : 1x3 cell class
result={cell_1, cell_2, cell_3, }
result={[2x1 double],[3x1 double],[1x1 double]}
cell_1 [999;222]
cell_2 [444;123;789]
cell_3 [9000]

채택된 답변

Walter Roberson
Walter Roberson 2017년 12월 15일
result = cellfun(@(C) C(~ismember(C, B)), A, 'uniform', 0);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by