Reading values and maps in CSV file
2 views (last 30 days)
Show older comments
Hi all,
I have got a large CSV file containing calibration values from ETAS INCA.
It looks like the following: ('xyz.CSV')
CALIBRATION VALUES V2.1,.,*,"",
,VARIABLE_NAME_1
* text that is always equal
VALUE,:"unit_x":,5.0
,VARIABLE_NAME_2
* text that is always equal
VAL_BLK',:"unit_y":, 0.5, 0.8, 1.1, 1.2, 1.4, 1.5
,VARIABLE_NAME_3
* text that is always equal
CURVE,VARIABLE_NAME_3_X, 1,2,3,4,5
:"unit_w":,10,20,30,40,50
,VARIABLE_NAME_4
* text that is always equal
MAP,VARIABLE_NAME_4_X
:"unit_z":,VARIABLE_NAME_4_Y,1,2,3,4,5
,2,3,4,5,6
,3,4,5,6,7
,4,5,6,7,8
What I want is, to import these calibration values to a .mat file.
My idea is to use the string '* text that is always equal' to find the names of the variables (line above), and the type (line below), and the data (line below / 2/more lines below).
I have tried reading on csvread, textscan, textread, dlmread, importdata, regexp, xlsread. But none of the options I tried, or found on the web helped me...
I managed to import and separate the numbers and text with
[numbers,text,rawdata]=xlsread('xyz.CSV')
, but from here I couldn't find out how to continue.
Some notes:
- There are always 2 lines empty between the last value and the next variable name
- There are 4 different kinds of variable formats: VALUE, VAL_BLK, CURVE, MAP with respective sizes: [1,1], [1,x], [2,x], [y,x]
- The example file is just to show all 4 formats, but it is much larger in reality.
I hope one of you can be of help, and my explanations is extensive enough to understand the issue.
0 Comments
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!