RL02 CSV Reader


Outline

CSV (comma-separated values) is a common data exchange format that is widely supported by consumer, business, and scientific applications. With the CSV Reader you can read all typical CSV files with text or numbers. With easy to use dialogs you can define configurations (separators, first line, labels, data types,...) for your specific formats. This article will help you configure and use the reader.

Platforms:
32/64bit 32/64bit 32/64bit
Requirements:
  • None
Known limitations:
  • File size limited by virtual memory and temporary storage
Status:
  • Stable
Operations:
  • Load
  • Stream
Default Parameters:
  • None
Configuration:
  • A CSV serializer configuration is required. The configuration defines the structure of the CSV file (separator, first line, labels,..).


Video

Screen Cast: Using the CSV Reader



About Comma-separated values

A comma-separated values (CSV) file stores tabular data (numbers and text) in plain text. Each line of the file is a data set. Each set consists of one or more fields, separated by commas or other delimiters. The top line may contain labels, associated with the fields.

Here a typical example:
 

time;osc_out;lvdt_outp;lvdt_outn
0;0;0;0
1.19209e-07;0.364121124438;0.361954160418;-0.361960938184
2.38418e-07;0.549114671567;0.544246145289;-0.544266588099
3.57627e-07;0.496353600022;0.488405852023;-0.488433470485
4.76836e-07;0.488886165659;0.478050306956;-0.478086469891


Usage

The reader can be used to open workspace resources and together with ports (direct connection to the target using TCP, Serial, J-Link, ...).



Configuration

You can modify the serializer behavior under Preferences->impuse->Serializer->CSV Reader:

The CSV Reader requires a configuration (CSV Configuration) to work. A configuration contains information about the char set, the delimiter, labels and and the actual data fields. Press "Add" and select "CSV Configuration" to create a new reader configuration:

  • Char Set: Select the char set that is used by the log file.
  • Domain Base: Select the domain base. This represents is smallest domain unit change (e.g 1 ms).
  • First row: Indicated the first row (starting with 1) of data or labels field.
  • Delimiter: The character to splits data and label fields.
  • Has labels: Check if the first row contains labels. These labels will be used to name the generated signals. If not given, standard names (S1 ,S2,..) will be taken.
  • Mode:  Select if the reader shall create a signal for each data column, or one struct signal with a member for each data column.

For each field you need to select a data type, "Domain" (only once), "Ignore" or "None". If you choose "Ignore" the field will not be used. If you choose "None", the field plus all fields to the right will be ignored. If you dont define a "Domain" field, the domain value will be iterated from zero.


The data type can be either:

  • Float,
  • Integer,
  • Text ,
  • or Enumeration.

The descriptor field can optionally contain a signal/member descriptor.

  • a content descriptor e.g. "default", "state", event" or "label", ...
  • a signal/member descriptor e.g. "default<df=Hex>" or "state<df=Text>"

The domain field needs a special handling. You can either choose:

  1. Date column: you need to define the date format. Use content proposals and http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html.
  2. Float domain value column: Parses a float value, optionally let it parse the domain unit from the data value or assign a unit.
  3. Integer domain value column: Parse an integer value, optionally let it parse the domain unit from the data value or assign a unit.
  4. No domain value: Use an index from 0..N.
  • Date format: You need to define the date format. Use content proposals and http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html.
  • Domain unit: In case of float or integer domain value you can enter a unit. If you leave the field blank, the reader tries to parse a unit from the data values.
  • Use relative domain value: If you check this flag, the reader will take the delta between the actual and first row domain value.


Parse errors

The reader will provide a parse error message if the input can not be read. The message usually contains the error position, the reason for the failure and a stack trace.

If you can not resolve the problem (e.g. obvious format error in the input file), please send this message together with the input file to "This email address is being protected from spambots. You need JavaScript enabled to view it.".

	Reader: de.toem.impulse.serializer.xyz 
	Error at position: 4800
	Text at position: "o !.
	Up
	Uq
	Ur"
	Message: Invalid character
	Type: class de.toem.impulse.serializer.ParseException
	Stack trace: 
	
	de.toem.impulse.serializer.xyz.xyzReader.parse(XYZReader.java:459)
	de.toem.impulse.serializer.xyz.xyzReader.parse(xyzReader.java:363)
	de.toem.impulse.serializer.xyz.xyzReader.read(xyzReader.java:269)
	de.toem.impulse.serializer.xyz.xyzReader.read(xyzReader.java:237)
	de.toem.pattern.element.Element$1.execute(Element.java:1063)
	de.toem.eclipse.hooks.actives.EclipseActives$3.run(EclipseActives.java:73)

toem

technical software and tooling

Company

Contact Us

This email address is being protected from spambots. You need JavaScript enabled to view it.