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!