Matlab Calculator


With this node one can apply simple operations on the content of Tables. The node has the same structure as the Calculator node with the difference that Matlab is used as scripting engine instead of Python, and that intermediary calculations can not be used.

Input ports:


Input Table

Output ports:


Table applied with MATLAB functions

List of calculations (calc_list)
List of calculations.
Copy input (copy_input)
If enabled the incoming data will be copied to the output before running the calculations. This requires that the results will all have the same length. An exception will be raised if the lengths of the outgoing results differ.
Action on calculation failure (fail_strategy)
Decide how a failed calculation should be handled

The calculator node can apply calculations on each data column in a list. The calculations are written as Python code and can consist of simple arithmetic calculations, Python function calls, or calls to functions defined in plugins.


You declare each calculation by typing a name in the text line labeled Signal name and entering the calculation in the textfield labeled Calculation. You can use any of the signals in the list Signal names in your calculation.

To use a signal from an incoming table type simply drag-and-drop the signal name from the list of available signals to the calculation field. To use a signal from the incoming generic data use arg in a way that fits the data format as can be seen below:

To add a function, drag-and-drop it from the Avaliable functions tree structure. Note that any signal that you reference in the calculation must exist in all incoming data structures.

To add a new calculation, press the New button and the Calculation field as well as Signal name will be cleared. If you want to edit a calculation simply click on the calculation in the List of calculations. The signal name will then appear under Signal name and the calculation will appear in the Calculation field. The calculation will be updated in the Calculation field, List of calculations and preview simultaneously. To remove a calculation, mark a calculation in List of calculations and press the Remove button. The result of your calculation is written to a column in an outgoing table.

If something goes wrong when you define the calculations you will get an error or warning message in the preview window and at the top of the window.

Some commonly used operators and functions can be found under the function tree structure (labeled Common functions) and can be added to a calculation by double-clicking or dragging the function name to the calculation area. If you want more information about a function, hover its name and its documentation will appear as a tooltip.

The signals that you access in the calculations are returned as numpy arrays, the same as if you had called get_column_to_array() from the Table API. This means that simple arithmetics and the functions from numpy and pandas work out of the box. But if you want to apply some other function which only works on a single element of the column you may need to use Python list comprehensions. For (the contrived) example:

filenames = np.array([value + value for value in signal])

where signal is a table column.


Each column of the output will have a calculation attribute with a string representation of the calculation used to create that column.

In the configuration, there is an option on how to handle exceptions (Action on calculation failure) produced by the node, for example missing signals or erroneous calculations.

In the list of calculations there is also the option to disable individual calculations, i.e., exclude them from the output. This makes it possible to make intermediary calculations that does not have the same lengths as the the calculations that are actually output by the node. This could for example be useful for constants.


Under python 2 the calculations are evaluated with future imports division and unicode_literals activated. This means that in both python 2 and python 3 the calculation 1/2 will give 0.5 as result, and the calculation ‘hello’ will result in a unicode-aware text object (unicode in python 2 and str in python 3). To get floor division use the operator // and to get a binary string (str in python 2 and bytes in python 3) use the syntax b'hello'.

class node_old_calculator.MatlabCalculator[source]

Example flows