File Exchange

image thumbnail

String to Cells

version (1.43 KB) by Cole Stephens
Split a single string into a cell array.

1 Download

Updated 01 Sep 2016

View Version History

View License

Take a single string and separate out individual "elements" into a new cell array. Elements are defined as non-blank characters separated by spaces.
Similar to str2cell, except str2cell requires an array of strings. str2cells requires only 1 string.

Example: Consider the following string in the workspace:
aString = ' a b c d efgh ij klmnopqrs t u v w xyz '

>> newCell=str2cells(aString)'

newCell =


Cite As

Cole Stephens (2021). String to Cells (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

urs Schwarz (us)

1) what is str2cell? where does it live?
2) no need for this, really:

Fahad Al Mahmood

This function does the same thing as the function (explode) created by Sara Silva.

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: rsplit

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!