remove rows if they contain ?

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 件のコメント

madhan ravi
madhan ravi 2019 年 2 月 23 日
upload your table as .mat file

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2019 年 2 月 23 日
編集済み: Image Analyst 2019 年 2 月 23 日

0 投票

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, :) = []

カテゴリ

ヘルプ センター および File ExchangeTables についてさらに検索

タグ

質問済み:

2019 年 2 月 23 日

編集済み:

2019 年 2 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by