RFILE_fRead from input fileBlock ScreenshotContentsDescriptionData typesParametersDefault propertiesInterfacing functionComputational functionExampleSee alsoDescription
This block allows user to read data in a file with the name defined with the
Input File Name parameter, in text formatted mode
or in binary mode.
The file is a sequence of records. Each record has the length
Record Size+ 1 and the structure
shown below:
The Time Record Selection parameter allows to user
the selection of one field in the record which represents time events.
When this parameter is set, an activation output is added to the block to return
these events to the user. With a feedback of the activation output to the event input
of the block, the records are read in sequence until file end as in the example below.
The Outputs Record Selection is used to select the
record's fields which will be included in the regular output.
The Output Format parameter gives the record format.
For a binary file, this parameter is an empty string.
For a text file, this parameter is a string of format (Fortran syntax)
enclosed by parentheses.
Each event on the activation input of the block advances one record in the file.Data types
Output: a scalar or a column vector of data of type double. The vector length
is equal to the length of the
Outputs Record Selection vector.
ParametersTime record selection An empty matrix or a positive integer.
If an integer
i
is given the
ith
element of the read record is assumed to be the date of the output event.
If it is an empty matrice, no output event exists. Properties : Type 'vec' of size -1. Outputs record selection
A vector of positive integer
[ki,...,kn]
the element
kith
of the read record gives the value of the
ith
output.
Properties : Type 'vec' of size -1. Input file name
A character string defining the path of the file. The block support file name
expansion and you can use environment variables like PWD
in the path, by example "PWD/my_data/".
Without path specifier, the file is read in the directory defined by the
PWD variable.
The file must exist, otherwise you will be prompted by an error message. Properties : Type 'str' of size 1. Input Format
A character string defining the Fortran format to use or nothing for an
unformatted (binary) write. If given, the format must began by a left
parenthesis and end by a right parenthesis. Example:
(10e3) Properties : Type 'str' of size 1. Buffer size
To improve efficiency it is possible to buffer the input data.
The reading of samples on the peripheral fills
the buffer so that there are always available data in memory for the block.
Properties : Type 'vec' of size 1.Default propertiesalways active: no
direct-feedthrough: no
zero-crossing: no
mode: no
regular outputs:- port 1 : size [1,1] / type 1number/sizes of activation inputs: 1
number/sizes of activation outputs: 0
continuous-time state: no
discrete-time state: yes
object discrete-time state: no
name of computational function:readfExample
This example reads the file:
"SCI/modules/xcos/examples/sources_pal/en_US/rfile_f.txt"
which contains a set of data.
It use its activation output as event input of CSCOPE. In the file, the first field
of the record is the time, the two others are regular data. The feedback of the
activation output on event input ensures the file sequential read.
Interfacing function
SCI/modules/scicos_blocks/macros/Sources/RFILE_f.sci
Computational function SCI/modules/scicos_blocks/src/fortran/readf.f (Type 0)See also
READC_f
WRITEC_f