How can I separate Complicated CSV file
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Barry Smith
am 15 Nov. 2017
Bearbeitet: Chris Perkins
am 17 Nov. 2017
How I would go about separating this csv file:
Header Header Header Header
1 row of data
Header Header Header
... Variable amount of data rows ...
Repeated x amount of times.
Many thanks
0 Kommentare
Akzeptierte Antwort
Chris Perkins
am 17 Nov. 2017
Bearbeitet: Chris Perkins
am 17 Nov. 2017
Hi Barry,
Since there is no marker present in the CSV file to say which rows are headers and which contain data, and since there are a variable number of rows with data, you will need to manually determine which rows contain headers by looking at the data once it has been imported to MATLAB using either the import tool or a specific function to read the CSV file.
Once you have determined which rows contain header values (say, row x1, x2, x3 ...) you can then extract rows 1-x1 and place those rows in their own matrix or table, then do the same for rows x1+1 to x2, and x2+1 to x3, and so on.
Alternatively, you could use the import tool multiple times and just select one section of rows at a time from the CSV file.
For more information about the import tool, see the following documentation link:
If it is possible for you to adjust how the CSV file is created so only the first row contains header information, that may be an easier workflow.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Whos 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!