Reading a Column Vector of Strings from a *.txt file in Linux
이전 댓글 표시
Working on Ubuntu.
have a text file example.txt of the form:
string1
string2
string3
...
To read into a column vector do:
fileID=fopen('/home/data/example.txt');
formatSpec='%s\n';
example==fscanf(fileID,formatSpec);
Unfortunately variable looks like:
string1string2string3...
What am I doing wrong?
채택된 답변
추가 답변 (1개)
Luuk van Oosten
2015년 2월 10일
Hi,
A suggestion:
a(:,1) = importdata('yourdata.txt')
카테고리
도움말 센터 및 File Exchange에서 String Parsing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!