Effacer les filtres
Effacer les filtres

Delete rows with strings for a cell array

2 vues (au cours des 30 derniers jours)
Rooy
Rooy le 26 Juin 2013
Commenté : Sonisa le 25 Fév 2016
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

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 26 Juin 2013
Modifié(e) : Andrei Bobrov le 26 Juin 2013
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 commentaires
Rooy
Rooy le 27 Juin 2013
I must have changed the code, anyway it works.
Thank you
Sonisa
Sonisa le 25 Fév 2016
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by