How do I import text from a text file in matlab?
조회 수: 2(최근 30일)
표시 이전 댓글
I have a list like this in a MacBook text file.
frame
picture
wall
room
house
I want to import it in Matlab and use every word in a loop. How do I import the list so I can use it from another handle?
I know how to use it in the loop after I get lenght of matrix and make a loop from 1:end.
댓글 수: 2
답변(1개)
Walter Roberson
2017년 9월 20일
S = regexp( fileread('TheFileName'), '\s+', 'split')
Now S is a cell array of the words in the file
댓글 수: 0
참고 항목
범주
Find more on Text Files in Help Center and File Exchange
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!