FromTextFile
This block reads in data from an ASCII text file. The data is read in columnwise.
Library
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
Name | Label | Description | Data Type | Valid 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' |
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 |
firstder | First derivative output | If selected, an output port provides the first time derivative of the signal. | Number | 0 |
secondder | Second derivative output | If selected, an output port provides the second time derivative of the signal. | Number | 0 |
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 |
Name | Label | Description | Data Type | Valid 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' |
Leftside | Behavior before the data time span | String | 'Zero' | |
Rightside | Behavior after the data time | String | 'Zero' | |
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
Name | Type | Description | IO Type | Number |
---|---|---|---|---|
s | explicit | output | 1 | |
Port 2 | explicit | output | firstder+firstder*secondder | |
Port 3 | activation | input | externalActivation | |
Port 4 | activation | output | outevent |
Advanced Properties
Name | Value | Description |
---|---|---|
always active | no | Time Dependency = standard mode activated |
direct-feedthrough | no | |
zero-crossing | no | |
mode | no | |
continuous-time state | no | |
discrete-time state | no |