Reading a Column Vector of Strings from a *.txt file in Linux
Show older comments
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?
Accepted Answer
More Answers (1)
Luuk van Oosten
on 10 Feb 2015
Hi,
A suggestion:
a(:,1) = importdata('yourdata.txt')
Categories
Find more on String Parsing 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!