I have a line
'A, B, C, D'
from which I want to create an array of cells, for example
{'A', 'B', 'C', 'D'}
How can I do this in matlab?
Here's a solution that will cut the line with commas, semicolons or spaces, and will work for strings of any length
string = 'A, BB, C' tmp = regexp(string,'([^ ,:]*)','tokens'); out = cat(2,tmp{:}) out = 'A' 'BB' 'C'
In your specific example, try:
cellstr(strread('A, B, C, D','%c,'))'
simpler way: t1 = strsplit ('A, B, C, D', ',');
Source: https://habr.com/ru/post/1411793/More articles:Data Transfer Issues in DetailViewController from TableView in iOS5 - iosGet parent directories of a file, down to the point - pythonAny optimized way to encrypt and decrypt a file inside Android - javaInfinitest with Eclipse 4 (Juno) - javaF suffix for the number assigned to the double - c ++how to compare date with current date in groovy - grailsIs there a way to embed a terminal window in TextMate? - shellWatin timeout when using SignalR - signalrHow can I refer to a closure using a string in the same way as is done using a member function without using eval? - javascript.Doc Files Not Included in ASP.NET Publish - asp.net-mvc-3All Articles