Reading Text and Parsing by Character
이전 댓글 표시
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!
댓글 수: 4
Oleg Komarov
2012년 7월 30일
The example you provided is misleading (or I don't understand it) since the second line of code will return exactly the first line.
Nikolay Rodionov
2012년 7월 30일
Walter Roberson
2012년 7월 30일
[] is the horizontal concatenation operator. ['a' 'b'] has exactly the same result as 'ab' . Are you looking for a cell array of strings? {'a' 'b'} ?
Nikolay Rodionov
2012년 7월 31일
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!