Borrar filtros
Borrar filtros

How to remove a specific object from cell

2 visualizaciones (últimos 30 días)
Anil Rajajapantulu
Anil Rajajapantulu el 20 de Ag. de 2019
Comentada: Anil Rajajapantulu el 22 de Ag. de 2019
I have a cell containing objects.
AllObjects = {obj1 , obj2 obj3 ....., obj10}
i want to remove obj3 from AllObjects cell.

Respuesta aceptada

Adam Danz
Adam Danz el 20 de Ag. de 2019
Editada: Adam Danz el 21 de Ag. de 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) = [];

Más respuestas (1)

JIAYING WU
JIAYING WU el 20 de Ag. de 2019
AllObjects(3) = [ ];
  1 comentario
Adam Danz
Adam Danz el 20 de Ag. de 2019
...if you already know that obj3 is in position (3)

Iniciar sesión para comentar.

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by