How to delete some specific rows in a cell matrix?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
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'}
Answers (1)
James Tursa
on 28 Feb 2017
Edited: James Tursa
on 28 Feb 2017
r = any(cellfun(@(x)isequal(x,'youth'),A),2); % Rows that contain 'youth'
A(r,:) = []; % Delete those rows
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!