필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Tiffany Lee
Tiffany Lee 2012년 11월 14일
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]

답변 (1개)

C.J. Harris
C.J. Harris 2012년 11월 14일
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
Tiffany Lee
Tiffany Lee 2012년 11월 14일
thanks for the quick response! works great!
Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 14일
편집: Azzi Abdelmalek 2012년 11월 14일
Tiffany you have to accept one of the answers that answers your question by clicking on accept this answer

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by