Matlab block
The Matlab® block allows you to specify a Matlab function and use it to manipulate fields which are passed as an array parameter to the function.
Description
The Matlab block allows you to specify a Matlab function and use it to manipulate fields which are passed as an array parameter to the function. When executed, the Matlab block calls the specified Matlab function with an array input parameter. The elements of the input array are mapped from selected field values, timestamps, and qualities on the block input port, according to block configuration. Once the Matlab function has executed, it returns an array. The elements of the array returned are mapped into block output fields, according to block configuration.
Matlab block
Block Type
Rules and Models
Input port
There must be one and only one input port. The input port can accept any number and any type of fields. There must be at least one input field.
Output port
There must be one and only one output port. The number and types of output fields are determined by the Matlab function and block configuration. There must be at least one output field.
Functions performed on tags
Value, quality, and timestamp behavior is as follows:
On the Values: Values are determined by the Matlab function. Output field values contain the values from the function return array elements.
On the Qualities: Output field qualities are set to good if a valid return array element is available for the given execution.
On the Timestamp: Output field timestamps are set to execute time if a valid return array element is available for the given execution.
If a configured output field does not have a value assigned by the Matlab function (for example, if the number of configured output fields is greater than the number of fields returned by the function), then the surplus field (whether value, quality, or timestamp) is not updated from the value it had on the previous execute.
If the Matlab function returns an error, then values are left unchanged from the previous execute, qualities are set to bad, and timestamps are set to execute time, for all fields. An error is also logged to the event log.
Runnability
Minimum requirements for runnability on the Matlab block are:
The Matlab DLL is found.
The Matlab function is found.
The Matlab Compiler Runtime (MCR) is present.
The MCR version is correct.
Related topics: