Skip to main content
Version: current

Import from CSV

Description

In SAFE you can import csv files to make it convenient to process tables from e.g. Excel.

MxN

The format of the .csv file is as follows for an MxN data size. The header consists of the sample rate fs the xlabel, the ylabel and the tag and unit for each channel. It is important that the tags for x and y match, and the units for x and y match respectively. After the header the data is inserted. All the x data first, followed by the y data.

fs=int......
xlabel=str......
ylabel=str......
tag_0 [x_unit]...tag_N [x_unit]tag_0 [y_unit]...tag_N [y_unit]
x_data_0_0...x_data_0_Ny_data_0_0...y_data_0_N
..................
x_data_M_0...x_data_M_Ny_data_M_0...`y_data_M_N

Output

The output is MxN and is the data from the .csv file, with the specified sample rate and x- and y-label

Attributes

AttributeValue
NameImportCsv
Settings
Path' '
Separator,
Outputs1

Name

Name specifies the name of the block.

Path

Path specifies the path to the .csv file and will open a file explorer.

Separator

Separator specifies the separator type used in the .csv file. The separator can either be , or ;.

Outputs

Outputs specifies the number of output(s) the block will have. Each output will output the same csv import.

Examples

A single channel import.

fs=48000,
xlabel=Time,
ylabel=Amplitude,
Measurement 1 [s],Measurement 1 [Pa]
1,11
2,12
3,15
4,17
5,20

Multicolumn data import.

fs=48000,,,
xlabel=Time,,,
ylabel=Amplitude,,,
Measurement 1 [s],Measurement 2 [s],Measurement 1 [Pa],Measurement 2 [Pa]
1,1,11,66
2,2,12,114
3,3,15,150
4,4,17,19
5,5,20,10

Literature