Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Check if number in Row, if not delete the complete column

3 ビュー (過去 30 日間)
Marv
Marv 2015 年 10 月 13 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello, this is the Data:
TestData = {'A','B','C','D';...
3,4,8,7;...
4,9,5,9;...
5,[],2,[];...
7,[],2,[];...
1,[],6,[]}
1. Check if in row 4 is a number
2. If not, delete the complete column where is not a number.
3. In this case this means: Delete column B and D.
The real data is very big, over 10000 rows...
How can I do this ?
  1 件のコメント
Image Analyst
Image Analyst 2015 年 10 月 13 日
Is this homework? Sounds like it? If so, tag it as homework.

回答 (1 件)

goerk
goerk 2015 年 10 月 13 日
You can try this
mask = cellfun(@isempty, TestData);
deleteColumn = sum(mask)>0;
TestData(:,deleteColumn) = [];

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by