How to delete some specific rows in a cell matrix?

Lets say i have a cell matrix of A = {'youth' 'cool' 'poor' ;'youth' 'notcool' 'poor' ;'old' 'notcool' 'rich'}; i want to delete the rows which contains 'youth' , so that my remaining answer will be only A={'old' 'notcool' 'rich'}

Respuestas (1)

James Tursa
James Tursa el 28 de Feb. de 2017
Editada: James Tursa el 28 de Feb. de 2017
r = any(cellfun(@(x)isequal(x,'youth'),A),2); % Rows that contain 'youth'
A(r,:) = []; % Delete those rows

La pregunta está cerrada.

Preguntada:

el 28 de Feb. de 2017

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by