Split string with successive delimiters
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
sushma sharma
le 21 Avr 2017
Réponse apportée : Walter Roberson
le 21 Avr 2017
Hi,
I have a string, A = 'matlab,2016,b,,,'
I am trying to extract the characters between the commas using strsplit. however, at the end of the string there are no space between the comma delimiters, and they get grouped as one cell, instead of empty cell.
How can split the string, with the comma as the delimiter, and no space between successive delimiters being treated as a blank cell?
thanks!
s
0 commentaires
Réponse acceptée
Walter Roberson
le 21 Avr 2017
>> A = 'matlab,2016,b,,,'
A =
'matlab,2016,b,,,'
>> regexp(A,',','split')
ans =
1×6 cell array
'matlab' '2016' 'b' '' '' ''
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrices and Arrays 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!