Borrar filtros
Borrar filtros

remove rows in cell if a column is equal to a number

1 visualización (últimos 30 días)
Tiffany Lee
Tiffany Lee el 14 de Nov. de 2012
So this is a simplified version of what I have, I want to remove the rows in X that match the number in the cell Y, so all I would have left is the first row. My real data has over a million rows, is there a quick way to do this? Thanks for your help!
X =
'B737' 'DAL1240' [10]
'MD88' 'DAL1542' [ 9]
'B747' 'DAL1284' [ 9]
'B737' 'DAL1532' [ 4]
'A320' 'DAL1417' [ 4]
Y =
[9]
[4]

Respuestas (1)

C.J. Harris
C.J. Harris el 14 de Nov. de 2012
X = {'B737' 'DAL1240' [10]
'MD88' 'DAL1542' [ 9]
'B747' 'DAL1284' [ 9]
'B737' 'DAL1532' [ 4]
'A320' 'DAL1417' [ 4]};
Y = {[9]
[4]};
X(ismember(cell2mat(X(:,3)),cell2mat(Y)), :) = [];
  2 comentarios
Tiffany Lee
Tiffany Lee el 14 de Nov. de 2012
thanks for the quick response! works great!
Azzi Abdelmalek
Azzi Abdelmalek el 14 de Nov. de 2012
Editada: Azzi Abdelmalek el 14 de Nov. de 2012
Tiffany you have to accept one of the answers that answers your question by clicking on accept this answer

Iniciar sesión para comentar.

Categorías

Más información sobre Large Files and Big Data 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