Data Filtering Help Needed?

조회 수: 1 (최근 30일)
Minjun Seo
Minjun Seo 2019년 8월 11일
댓글: Minjun Seo 2019년 8월 11일
Hi I have a data table that I loaded through the workspace.
I saved this table into a variable, let's say x.
Now in one specific column, it says Y for a yes and blank for a no.
How can I cut out the rows that have a blank space in that column?

채택된 답변

Image Analyst
Image Analyst 2019년 8월 11일
Try something like this:
col = 2; % Whatever it is...
theColumn = x{:, col}; % Extract column 2 as a cell array from the table.
rowsToDelete = contains(theColumn, ' ');
x(rowsToDelete, :) = []; % Delete all rows where a space was in col 2
If that doesn't work, attach x in a .mat array:
save('answers.mat', 'x');
and attach it with the paper clip icon.
  댓글 수: 1
Minjun Seo
Minjun Seo 2019년 8월 11일
Hi, I attached the data file above, maybe my wording was off but the method you provided did not work. I would also like to know how to delete the rows from the table and saving it to another place.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by