Connector
MATLAB
Run MATLAB code on the test machine
- Category
- Tools
- Kind
- tool
- Capabilities
- EngineOperations
- Runs on
- Linux x64macOS Apple siliconmacOS IntelWindows x64
Run MATLAB code from Phloem. The agent and Computer can evaluate expressions, run scripts and read variables back.
What you get
- Operations —
eval(run an expression),run_script, andget_variable(run code and read one variable back), plus a connection test. - Each call runs MATLAB headless (
matlab -batch) on its own. Nothing carries over between calls.
Setup
- Install the connector from the Connectors tab and open its page.
- Point it at your MATLAB installation, then press Test to confirm.
Computed channels
A computed channel runs your function over a window of a signal and publishes the result as a new channel. Your function gets one window struct:
function result = my_metric(win)
% win.t_us — sample times, microseconds since 1970-01-01 UTC
% win.value — the sample values, same order
result = max(win.value) - min(win.value);
end
Return one number, or a struct of names to numbers for several outputs. Times are microseconds; divide by 1e6 for seconds.
Notes
- Put everything a computation needs in one eval.
get_variabletakes the code that sets the variable and its name, and runs both in one call. - A call that runs too long is stopped, along with anything MATLAB started.
- A sample with no reading arrives in
win.valueasNaN.
#Connection fields
Every field the Add input form shows for this connector.
| Field | Type | Required | Default |
|---|---|---|---|
MATLAB binary path/usr/local/MATLAB/R2026a/bin/matlab | Text | — | — |
Updated