Read a big csv file with text and data and find specific column in it
1 view (last 30 days)
Show older comments
I'm using big csv files (870 columns, 6000 rows).
To open and read a file, I use the command :
[fileName,filePath] = uigetfile({'*.csv','Excel Files'});
fid=fopen([filePath,fileName]);
fid = fileread(fileName);
tab = textscan(fid,[repmat('%f',[1,1500])],'Delimiter',';','HeaderLines',7);
In this big file, I need only few columns.
The problem is that the number of rows and columns and the location of a specific data column depend on the file.
That's why I want to find the column I need with its name.
So how to localise in my tab a specific column which has its name in the headerline ?
For instance, I want to skip the 4 first lines, to import the data in the column 'C' under 'DEM' and to create a vector DEM with these data.
Thank you for your help !
0 Comments
Answers (0)
See Also
Categories
Find more on Text Files 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!