Read and sort data in a text file
Show older comments
Greetings,
I have a text/ascii file that looks like below. The first line contains the variables names, and all lines beyond the first contain a mix of numerical and string values. The data is not stored in any specifc/ascending/descending order. What I'd like to do is load all the data into arrays (or structures?) for further manipulation/processing. All variables (beyond the first line) are separated by commas.
I've tried the FID=fopen(...) and then read one line at a time, but that's painfully slow as some of the data files are rather large.
X, Y1, Y2, Y3, Txt1, Txt2, Slope
22,17,31.5,Positive,False,-1
24,11,42.5,Flat,False,-1
17,13,33.0,Flat,True,1
...
Accepted Answer
More Answers (2)
Djamil Boulahbal
on 16 Sep 2020
0 votes
Djamil Boulahbal
on 17 Sep 2020
Edited: Djamil Boulahbal
on 17 Sep 2020
0 votes
Categories
Find more on Characters and Strings 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!