How to remove a specific object from cell

2 Ansichten (letzte 30 Tage)
Anil Rajajapantulu
Anil Rajajapantulu am 20 Aug. 2019
I have a cell containing objects.
AllObjects = {obj1 , obj2 obj3 ....., obj10}
i want to remove obj3 from AllObjects cell.

Akzeptierte Antwort

Adam Danz
Adam Danz am 20 Aug. 2019
Bearbeitet: Adam Danz am 21 Aug. 2019
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) = [];

Weitere Antworten (1)

JIAYING WU
JIAYING WU am 20 Aug. 2019
AllObjects(3) = [ ];
  1 Kommentar
Adam Danz
Adam Danz am 20 Aug. 2019
...if you already know that obj3 is in position (3)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Properties finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by