How to remove a specific object from cell

조회 수: 3 (최근 30일)
Anil Rajajapantulu
Anil Rajajapantulu 2019년 8월 20일
댓글: Anil Rajajapantulu 2019년 8월 22일
I have a cell containing objects.
AllObjects = {obj1 , obj2 obj3 ....., obj10}
i want to remove obj3 from AllObjects cell.

채택된 답변

Adam Danz
Adam Danz 2019년 8월 20일
편집: Adam Danz 2019년 8월 21일
Try this out
% identify the index of cell array "AllObjects" that contains "obj3"
idx = cellfun(@(x)isequal(x,obj3),AllObjects); %logical index
% Remove that index from cell array
AllObjects(idx) = [];

추가 답변 (1개)

JIAYING WU
JIAYING WU 2019년 8월 20일
AllObjects(3) = [ ];
  댓글 수: 1
Adam Danz
Adam Danz 2019년 8월 20일
...if you already know that obj3 is in position (3)

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by