Matlab Table¶
None
Ports:
Inputs:
port2: datasource
M-file (.m)
port0: table
Input Table
Outputs:
port1: table
Table with MATLAB script applied
Configuration:
Similar to the function selector, F(x), one can with this node apply non-general functions/scripts to the content of Tables. The difference is that this node uses Matlab as scripting engine instead of Python. Another difference is that the Python file coming in to the function selector includes one or many selectable functions, which is not the case for this node. Here, the Matlab file only consists of a single written script.
In the Matlab script one reaches the table data in the Table with the arg variable
in_data = arg
and sets the output in the res variable:
res = out_data
A small example of how to access the input and output data:
names = arg.column_names();
price = names(1, :);
price_value = arg.get_column_to_array(price);
out_table = Table();
out_table = out_table.set_column_from_array(...
'MAX_PRICE', max(price_value), [[], []]);
out_table = out_table.set_column_from_array(...
'MIN_PRICE', min(price_value), [[], []]);
out_table = out_table.set_table_attributes([]);
res = out_table;
Some executable examples are located in Sympathy/Matlab/Examples.
See Matlab API for all functions that can be used on the input/output table(s).