Read a big csv file with text and data and find specific column in it
4 ビュー (過去 30 日間)
古いコメントを表示
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 ?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163687/image.png)
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!