Vector/Matrix - Load

Symbol:

Description:

This function block can read saved data from a file to load the content 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 data in the file, fitting elements will be transferred, nonetheless (see example below).

Data will only be read, when 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 are 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

-2

-3

-4

-5

-6

-1000

Function block does not operate

No file name given

Couldn't open file

Unknown/invalid file format

Date type incompatible

Error in the file header

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.

Example:

Matrix in the file

Matrix VX before LOAD

Matrix VX after LOAD


Vector/Matrix - Save

Attention! Some kinds of memory media (e.q. flash cards) only allow a limited number of writing operations!

Symbol:

Description:

This function block saves the data from a matrix (vector, single value) into a file.

The elements at the input VX will be saved to the file FName, when a positive going edge occurs at the Trigger input. Additional information like data type and dimension will be stored in the file header to be able to check at load.

The output Num gives the number of saved elements. A negative value indicates an error or shows that the function block is not operating:

-1

-2

-3

-4

-1000

Function block does not operate

No file name given

Couldn't open file

Number of saved elements differs from elements at VX

Target function not available

Trigger à change to HIGH = Save date

Signals:

Name

I/O

Type(s)

Function

VX

I

Data type independent

Input vector/matrix

FName

I

TEXT

File name

Trigger

I

BIT

Trigger to save date

Num

O

LONG

Number of saved elements of status information

Visualization:

The selected data type will be displayed by the assorted color.

Comments:

Exiting files will be overwritten!

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. This function block do not generate sub directories, so trying to create a file in a non existing sub directory will lead to an error.

Some memory media only allow a limited number of writing operations. Heavy use of this function block may destroy such a media!