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