remove rows if they contain ?
조회 수: 1 (최근 30일)
이전 댓글 표시
I want to remove all rows that contain ?
The issue is that ? could be in any of my 14 columns
I tried this code ("data" is the name of my table here)
data(ismember(data,'?'),:)=[];
but i get the error
Error using tabular/ismember (line 37)
A and B must both be tables, or both be timetables.
답변 (1개)
Image Analyst
2019년 2월 23일
편집: Image Analyst
2019년 2월 23일
This works:
column1 = {'a'; 'b'; '?'; 'c'; 'd'}
column2 = {'a'; '?'; 'x'; 'c'; 'd'}
data = table(column1, column2)
% Now that we have sample data, delete any column with a '?' in it.
rowsToDelete = any(contains(data{:, :} , '?'), 2)
data(rowsToDelete, :) = []
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!