MatlabExecutor

MatlabExecutor(
    wrapper_name,
    input_path='temp_in.csv',
    output_path='temp_out.csv',
)

A CLIExecutor that runs a MATLAB function in headless batch mode.

Builds the command matlab -batch "wrapper_name('<input>', '<output>')" -nosplash -nodesktop, so MATLAB must be on your PATH. The wrapper function must take two string arguments, the input and output CSV paths, read the inputs and write the results.

Parameters

Name Type Description Default
wrapper_name str Name of the MATLAB function (e.g. 'matlab_wrapper'); a trailing .m is removed. required
input_path str CSV file written for MATLAB to read. Defaults to "temp_in.csv". 'temp_in.csv'
output_path str CSV file MATLAB must write. Defaults to "temp_out.csv". 'temp_out.csv'

Examples

# With matlab_wrapper.m on the MATLAB path
executor = MatlabExecutor(wrapper_name='matlab_wrapper')