File Exchange

image thumbnail

split

version 1.0.0.0 (457 Bytes) by Gerald Dalley
Splits a delimited string into a cell array.

1 Download

Updated 11 May 2004

No License

Splits a delimited string into a cell array. Example: split('_/', 'this_is___a_/_string/_//') returns {'this', 'is', 'a', 'string', []}.

Tested on MATLAB R12.1 and R13.

Cite As

Gerald Dalley (2021). split (https://www.mathworks.com/matlabcentral/fileexchange/4873-split), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (11)

Xiang LI

Patrick Mineault

A more efficient way of doing the same thing which supports tabs and newlines:

splitchar = '\n'; %Split on newline characters
C = textscan(s,['%s' splitchar]);

xiaohui chen

cant believe

no support for tabs? wtf?

Abel Brown

This rocks! so useful in perl. nice to have it for matlab also! Nice work

saideh rad

Ricardo Hernandez-Perez

Thanks for sharing this, it's great! It saved a lot of work

hi choi

Just what I needed. Thanks a lot!

R Hunt

thanks for sharing this

Jonathan Moore

convenient

amir k

Works well

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: rsplit

Community Treasure Hunt

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

Start Hunting!