I have following string
'A, B, C, D'
from which I want to make a cell array such as
{ 'A', 'B', 'C', 'D' }
How would I be able to do this in Matlab?
Here's a solution that will cut up the string at commas, semicolons, or white spaces, and that will work for strings of any length
string = 'A, BB, C'
tmp = regexp(string,'([^ ,:]*)','tokens');
out = cat(2,tmp{:})
out =
'A' 'BB' 'C'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With