Search code examples
matlabdelimitertextscan

Matlab, textscan: sequence of punctuation marks


I want to split a string using "," as delimiter but I'm not able. I tried:

temp = textscan('the first","the second','%s',2,'Delimiter','","');

but the result is:

temp{:}

ans = 'the first'


Solution

  • temp = textscan('the first","the second','%s',5,'Delimiter',{'","'});
    

    I am unable to find the relevant part of the documentation, but with an array of chars textscan uses each char as an individual delimiter. Check temp = textscan('the first","the second','%s',4,'Delimiter','","'); to se how the delimiter is interpeded in your code.