Run MATLAB code and simulations from Codex

Connect Codex to RunMat Desktop and it runs MATLAB code and physics simulations in the Project you have open. Each run appears in the app.

Plot the damped radial wave sin(3r)/r on a 120-by-120 grid as a 3D surface.

Running code in RunMat

Here's the surface: a peak of 3 at the origin, with ripples that fade as they spread out. Drag to rotate it.

When to use it

Use it when the answer has to come from running something: your team's MATLAB code, a large calculation, or a simulation of a part.

  1. 01

    Your MATLAB code

    Point Codex at a script or a Project, and it runs the code as written, with more than 2,100 builtins and the full core language and no MATLAB install. When it fails, Codex reads the error, fixes the code and runs it again.

  2. 02

    Math at GPU speed

    Array math runs on the GPU and sweeps run in parallel, so one answer can cover 10 million samples or 10,000 design cases.

  3. 03

    Simulations of your parts

    Give it your CAD file (STEP, IGES or BREP) and Codex sets up the study: material, loads, supports and mesh. RunMat solves it and shows stress, temperature or mode shapes on the part.

Codex works on the files in the Project open in RunMat Desktop, and each run is saved there, so the next session picks up the same files.

What you can ask for

“Find the first natural frequency of this tuning fork and show the mode shape.”

A modal study on the part, with the mode shape in 3D.

“Here's my steel wall hook. Hang 2 kN from the hook seat with the three mounting holes fixed. What's the maximum deflection, and the mean von Mises stress in the two hook corner fillets?”

Steel wall hook under a 2 kN hanging load, colored by displacement magnitude from 0 to 0.0159 mm
A structural study on the hook's CAD geometry. Maximum deflection is 0.0159 mm, the mounting holes react the full 2,000 N, and the mean von Mises stress in the corner fillets is 10.2 MPa.

“Price this option with 10 million Monte Carlo paths on my GPU and check it against Black-Scholes.”

price_option.m
% 10 million price paths; RunMat runs the array math on the GPU
S0 = 100; K = 105; r = 0.03; sigma = 0.2; T = 1;
Z = randn(1e7, 1);
ST = S0 * exp((r - sigma^2/2)*T + sigma*sqrt(T)*Z);
price = exp(-r*T) * mean(max(ST - K, 0));
fprintf("Call price: %.2f\n", price);
output
Call price: 7.13
RunMat runs the array math on the GPU, on NVIDIA, AMD, Intel or Apple hardware, with no GPU code. The result matches the closed-form price of 7.13.

“Sweep 10,000 combinations of damping and stiffness across all my cores and find the worst case.”

sweep_damping.m
[Z, K] = ndgrid(linspace(0.05, 0.5, 200), ...
linspace(10, 500, 50));
t = linspace(0, 20, 4001);
peak = zeros(size(Z));
parfor n = 1:numel(Z)
wn = sqrt(K(n)); wd = wn*sqrt(1 - Z(n)^2);
peak(n) = max(abs(exp(-Z(n)*wn*t) .* sin(wd*t) / wd));
end
[pmax, i] = max(peak(:));
fprintf("Worst case: %.3f m (zeta %.2f, k %.0f N/m)\n", ...
pmax, Z(i), K(i));
output
Worst case: 0.293 m (zeta 0.05, k 10 N/m)
RunMat's parfor spreads the cases across every core on the machine, or across a cluster, from the same code.

Connecting Codex

Codex

  1. 1Install RunMat Desktop, sign in and open your Project.
  2. 2In Settings › Connections, under On this computer, choose Connect next to Codex. This installs the RunMat plugin.
  3. 3Start a new Codex session and enter /mcp to confirm the runmat server is connected.
  4. 4The first time Codex works in the Project, choose Allow while this project is open or Always allow in Connected agents.

Codex reaches RunMat while RunMat Desktop is open, and runs appear in the app.

Full setup guide

Plans and usage

Running code with RunMat is included in the Free plan, with no monthly cap. You can start up to 120 runs an hour, 5 at a time. Installing, signing in, reading files and reopening a plot don't count as runs.

Usage and limitsPricing

Works in
Codex, RunMat Desktop
Made by
RunMat
Price
Included with RunMat Free

Setup guideHow RunMat Agent worksTroubleshooting

Run MATLAB code and simulations from Codex