MATLAB Answers

Split string with successive delimiters

168 views (last 30 days)
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 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 21 Apr 2017
>> A = 'matlab,2016,b,,,'
A =
'matlab,2016,b,,,'
>> regexp(A,',','split')
ans =
1×6 cell array
'matlab' '2016' 'b' '' '' ''

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags