Vektor/Matrix Load
With this function block, saved data can be read from a file and loaded into a connected matrix (vector, single value).
The matrix (vector, single value) VX will be filled with the elements loaded from the file FName. If the dimension of an object at VX does not correspond to the dimension of the data in the file, fitting elements will be transferred, nonetheless (see example below).
Data will only be read, if a positive going edge occurs on the Trigger input. Before loading any date, the data type of the elements in the file are checked. Only if the data is compatible to VX the file will be read.
The output Num gives the number of read elements. A negative value indicates an error or shows that the function block is not operating:
-1 | Function block does not operate |
-2 | No file name given |
-3 | Could not open file |
-4 | Unknown/invalid file format |
-5 | Date type incompatible |
-6 | Error in the file header |
-1000 | Target function not available |
Trigger -> change to HIGH = Read data
Signals
Name | I/O | Type(s) | Function |
---|---|---|---|
VX | I/O | Data type independent | In-/output vector/matrix |
FName | I | TEXT | File name |
Trigger | I | BIT | Trigger to read data |
Num | O | LONG | Number of read elements or status information |
Visualization
The selected data type will be displayed by the assorted color.
Comments
The file name must follow the principles of the target system. This covers the conventions for the name itself (e.q. accepted characters) and the use of relative or absolute path information.