Textscan .txt into cell array
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am having a difficult time reading my .txt file in matlab. I want a 16 column cell array but I only get all my data in 1 column. How do I separate it into columns? I also used 'whitespace' to try to have 'AC Type' as a string but it just stops at AC. Any help is appreciated! thanks!
My data looks like this as a .txt
Timestamp,Latitude,Longitude,Fix,AC Type,AC ID,Runway,Tgt Type,Speed,Flight Level,Altitude,Heading,Track,Airport,X,Y
2011-04-19T00:01:59.000Z,33.63510372,-84.40547777,,,,,,1,,,,3115,KATL,1504,-732,
2011-04-19T00:01:59.000Z,33.5446075,-84.52443676,,,,,,293,112.0,11175,80.5,2827,KATL,-9548,-10770,
2011-04-19T00:01:59.000Z,33.63474397,-84.40776058,,,UNKN,,unknown,6,,1006,352.9,3104,KATL,1292,-772,
0 Kommentare
Antworten (1)
RNTL
am 25 Nov. 2012
Assume your file is the following myfile.txt:
a,b,c,4.31,AA-BB-CC,3
e,f,g,3.25,DD-EE-FF,5
Then use textscan as
fid = fopen(myfile.txt,'r');
txt = textscan(fid,'%s %s %s %f %s %d','delimiter',',');
fclose(fid);
and you get the required cell array.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Text Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!