FromTextFile

This block reads in data from an ASCII text file. The data is read in columnwise.

    FromTextFile

Library

Activate/SignalImporters

Description

The FromTextFile block reads data from ASCII text files. The data is read in columnwise.

Multiple columns can be read. Format of data read on each line is defined using scanf formatting statement.

If the block is activated by external activation and time stamp is also defined, the output are displayed at event activation times. The external activation may be turned off, if time instants are provided.

Parameters

FromTextFile_0

NameLabelDescriptionData TypeValid Values

fname

File name

Defines the name (path and full name, in between quotes) of the input text file.

String

NCol

Number of columns

Number of columns in the input file.

Scalar

OC

Requested columns

Columns to be read from the input file. [2,3] means to extract 2 vectors from columns 2 and 3 of the input file.

Vector

typ

Output datatype

Defines the datatype of the output of the block. Available datatypes are: double, int32, int16, int8, unit32, uint16, uint8.

String

'double'
'int32'
'int16'
'int8'
'uint32'
'uint16'
'uint8'

RFormat

Scanf read format

Format used to read each line. Default "%lg" The reading format is the same as used in the C language, e.g., "%lg" for reading float, "%d" for reading integer, etc.

String

TC

Number of columns (0 if absent) for time instants

Column where the time instants can be read. If time instant are absent in the file, use 0.

Scalar

outevent

Generate events at time instants

This parameter defines if the block generates an activation event. When OutEvent is used, a additional event output port is added to the block. default is OFF.

Number

0
1

firstder

First derivative output

If selected, an output port provides the first time derivative of the signal.

Number

0
1

secondder

Second derivative output

If selected, an output port provides the second time derivative of the signal.

Number

0
1

externalActivation

External activation

Specifies whether the block receives an external activation or inherits its activation through its regular input ports. When External Activation is selected, an additional activation port is added to the block. By default, external activation is not selected.

Number

0
1

FromTextFile_1

NameLabelDescriptionData TypeValid Values

Buffer

Buffer size

Size of the buffer. Integer value. Default is set to 1000.

Scalar

Method

Interpolation method

Defines how the data read in is interpolated.

String

'ZeroOrder'
'Linear'
'Not_a_knot'
'Natural'
'Clamped_To_Zero'
'Akima'
'Fritsch_Butland'
'Steffen'

Leftside

Behavior before the data time span

String

'Zero'
'Hold'
'Extrapolation'
'Repeat'

Rightside

Behavior after the data time

String

'Zero'
'Hold'
'Extrapolation'
'Repeat'

Offset

Read from line #

Number of the line to start reading the data in the input file. integer value. Default is set to 1. This in in particular useful there a overhead text in the data, such as in CSV files.

Scalar

Ports

NameTypeDescriptionIO TypeNumber

s

explicit

output

1

Port 2

explicit

output

firstder+firstder*secondder

Port 3

activation

input

externalActivation

Port 4

activation

output

outevent

Advanced Properties

NameValueDescription

always active

no

Time Dependency = standard mode activated

direct-feedthrough

no

zero-crossing

no

mode

no

continuous-time state

no

discrete-time state

no