필터 지우기
필터 지우기

Read a big csv file with text and data and find specific column in it

조회 수: 3 (최근 30일)
Ziad Sliti
Ziad Sliti 2017년 5월 3일
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개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by