Delete rows with strings for a cell array

조회 수: 1 (최근 30일)
Rooy
Rooy 2013년 6월 26일
댓글: Sonisa 2016년 2월 25일
I have a cell array that contains a few rows of strings and want to delete the whole row if they are all strings.
'Cause' 'CSSR (%)' 'MO Attempts' 'MT Attempts'
[1x20 char] [ 1] [ 1] [ 0]
I only want to delete the first row and not the second.
Thank you

채택된 답변

Andrei Bobrov
Andrei Bobrov 2013년 6월 26일
편집: Andrei Bobrov 2013년 6월 26일
A = {'Cause' 'CSSR (%)' 'MO Attempts' 'MT Attempts'
'fghytresdfhjjiiuyt' [ 1] [ 1] [ 0]};
out = A(any(~cellfun(@ischar,A),2),:);
or
out = A;
A(all(cellfun(@ischar,A),2),:) = [];
  댓글 수: 4
Rooy
Rooy 2013년 6월 27일
I must have changed the code, anyway it works.
Thank you
Sonisa
Sonisa 2016년 2월 25일
I have this format
'Time' 'DOY' 'VWC05' 'VWC10' 'VWC20' 'VWC50' 'T05' 'T10' 'T20' 'T50' 'PAW40' 'PAW65' '#' '#' 'cm^3/cm^3' 'cm^3/cm^3' 'cm^3/cm^3' 'cm^3/cm^3' '°C' '°C' '°C' '°C' 'mm' 'mm'
Which I want to delete it. They are on every 600th row, sometimes in 590th row. How do I delete it so that I can get the value that i want?
Thank you in advance.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by