PhloemDocs
Markdown
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, and get_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

  1. Install the connector from the Connectors tab and open its page.
  2. 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_variable takes 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.value as NaN.

#Connection fields

Every field the Add input form shows for this connector.

FieldTypeRequiredDefault
MATLAB binary path
/usr/local/MATLAB/R2026a/bin/matlab
Text——

Updated