Reading Text and Parsing by Character
11 views (last 30 days)
Show older comments
Hi, I need to somehow read in a text file with no standard delimiters (spaces,tabs,ect.) and parse it by character into a long single row array.
For example,
rand.txt = "thequickbrownfoxjumpsoverthelazydog"
finalarray = ['t' 'h' 'e' 'q' 'u' 'i' 'c' 'k'....]
Any advice??
Thanks in advance!
Accepted Answer
Albert Yam
on 30 Jul 2012
Edited: Albert Yam
on 30 Jul 2012
rand.txt = 'thequickbrownfoxjumpsoverthelazydog';
finalarray = regexp(rand.txt,'[a-z]','match')
Edit: if every character, including periods and such
finalarray = regexp(rand.txt,'.','match')
0 Comments
More Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!