How to delete specific rows in a table based on a value?
이전 댓글 표시
Hi all,
I have a big table with 6 columns and would like to delete all rows where one column contains a specific value.
That's how the table looks like:

I would like to delete all rows, where T.ISIN == 'DE0006205701'
May you please help me with this?
Thanks so much in advance!
댓글 수: 5
dpb
2020년 12월 13일
Show us what have you tried and where you ran into difficulty?
Image Analyst
2020년 12월 13일
편집: Image Analyst
2020년 12월 13일
Attach your table in a .mat file so we can try things with it.
save('answers.mat', 'T');
In the meantime, try ismember().
Carl Schneegaß
2020년 12월 13일
Carl Schneegaß
2020년 12월 13일
Carl Schneegaß
2020년 12월 13일
채택된 답변
추가 답변 (1개)
Image Analyst
2020년 12월 13일
Did you try ismember like I suggested above?
s = load('answers.mat')
T = s.T;
whos T % Show size.
% I would like to delete all rows, where T.ISIN == 'DE0006205701'
pattern = 'DE0006205701'
[ia, ib] = ismember(T.ISIN, {pattern});
fprintf('Found %d rows where ISIN = "%s". We will delete those.\n', sum(ia), pattern);
T(ia, :) = [];
whos T % Show size now.
카테고리
도움말 센터 및 File Exchange에서 Numeric Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!