RFILE_f ======= Read from input file Block Screenshot ~~~~~~~~~~~~~~~~ Contents ~~~~~~~~ + `Read from input file`_ + + `Palette`_ + `Description`_ + `Data types`_ + `Dialog box`_ + `Default properties`_ + `Example`_ + `Interfacing function`_ + `Computational function`_ + `See also`_ Palette ~~~~~~~ + `Sources palette`_ Description ~~~~~~~~~~~ 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. Dialog box ~~~~~~~~~~ + **Time record selection** An empty matrix or a positive integer. If an integer * `i`* is given the * `i th `* 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 * `[k i ,...,k n ]`* the element * `k i th `* of the read record gives the value of the * `i th `* 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 properties ~~~~~~~~~~~~~~~~~~ + **always active:** no + **direct-feedthrough:** no + **zero-crossing:** no + **mode:** no + **regular outputs:** **- port 1 : size [1,1] / type 1** + **number/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:** readf Example ~~~~~~~ This example reads the file: *"SCI/modules/xcos/examples/sources_pal/en_US/rfile_f.txt"* which contains a set of data generated by the example of the `WFILE_f`_ block help page. 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. `Open this example in Xcos`_ . 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 ~~~~~~~~ + `WFILE_f`_ Write to output file + `READC_f`_ Read binary data + `WRITEC_f`_ Write to C binary file .. _Dialog box: RFILE_f.html#Dialogbox_RFILE_f .. _Computational function: RFILE_f.html#Computationalfunction_RFILE_f .. _READC_f: READC_f.html .. _WFILE_f: WFILE_f.html .. _Read from input file: RFILE_f.html .. _Open this example in Xcos: nullscilab.xcos/xcos/examples/sources_pal/en_US/rfile_f_en_US.xcos .. _SCI/modules/scicos_blocks/macros/Sources/RFILE_f.sci: nullscilab.scinotes/scicos_blocks/macros/Sources/RFILE_f.sci .. _Data types: RFILE_f.html#Datatype_RFILE_f .. _Palette: RFILE_f.html#Palette_RFILE_f .. _Example: RFILE_f.html#Example_RFILE_f .. _Sources palette: Sources_pal.html .. _WRITEC_f: WRITEC_f.html .. _Interfacing function: RFILE_f.html#Interfacingfunction_RFILE_f .. _Default properties: RFILE_f.html#Defaultproperties_RFILE_f .. _See also: RFILE_f.html#Seealso_RFILE_f .. _Description: RFILE_f.html#Description_RFILE_f