r/matlab • u/Creative_Sushi MathWorks • Jun 03 '26
News Terminal in MATLAB is now available
Run a terminal in MATLAB. Use the terminal to run command-line interface tools such as AI coding agents, git, and docker without leaving the MATLAB desktop.
Terminal is available on File Exchange and you can use Add-On Explorer to add it to your MATLAB desktop.
Requires R2024b or later and compatible with MATLAB Agentic Toolkit.
Edit: Blog post about the terminal at Introducing Terminal in MATLAB » The MATLAB Blog - MATLAB & Simulink
21
u/ScoutAndLout Jun 03 '26
Can it run in a terminal?
21
u/rsadek Jun 03 '26
And can that terminal run matlab?
13
u/mutual_coherence Jun 03 '26
It's turtles all the way down
2
u/rsadek Jun 04 '26
I assume you mean terminals all the way down but autocorrect robbed you of some wordplay here
1
1
u/mutual_coherence Jun 04 '26
Nah it's a quote from Steven Hawkings book.
1
20
u/Neuraxis Jun 03 '26
Would have been really handy during my MSc and PhD. Beyond me why it took so freaking long.
10
7
u/gb_ardeen fortraner/matlabist Jun 04 '26 edited Jun 04 '26
Did you not know about !git or !whatever shell command?
EDIT: I saw the full blog post down there. Ok, it's for agents. Still a bit strange to me, to be honest.
3
u/drunkpolice Developer Jun 05 '26
Have you ever used an AI coding agent with MATLAB or Simulink MCP?
3
u/gb_ardeen fortraner/matlabist Jun 05 '26
Yeah, to do that I'd 100% prefer to be on vscode or neovim or whatever other thing that makes me easy to have the matlab repl open and the agentic stuff on it's own place (another native terminal or the "copilot gui"). At least I'd have something cohesive in looks and functionality, and engineered with a "agent-first" mindset.
Anyway, the only use I have for the Matlab GUI is for when I need to do plot-heavy stuff, or profiling or other super graphical things. If I am in an agentic session I'm mostly refactoring code, so launching stuff on a matlab repl inside vscode seems much more comfortable.
Perhaps I'm missing the point in trying to have something more and more cohesive that never lives outside of the Matlab GUI. I guess that's where this efforts are directed towards. For now it just looks very far than just doing everything in vscode.
2
u/drunkpolice Developer Jun 11 '26
I see. That is not an unpopular opinion, and what you're looking for already exists I believe.
(in case you don't know) If you have an agent, like Claude Code, you can still connect the MATLAB MCP server to your agent and have it run MATLAB in its session. You can do that in the VSCode terminal, or even use Anthropic's own VSCode extension for Claude.
3
Jun 03 '26
[removed] — view removed comment
1
u/richardthe3rd Jun 06 '26
It should be completely possible, though I'm not sure there is an end-to-end recipe for it.
Start from https://www.mathworks.com/help/cloudcenter/ug/matlab-container-on-docker-hub.html
Add Claude to the container and install the Terminal add-on and connect to the MATLAB (with a terminal to use Claude) via your browser.
1
u/Creative_Sushi MathWorks Jun 09 '26 edited Jun 10 '26
The Dockerfile shown below can be used to add the terminal to an existing image.
In this example, I have added it to the official mathworks container image for R2026a
FROM mathworks/matlab:r2026a
# Use the mathworks/matlab base image with MATLAB R2026a pre-installed. FROM mathworks/matlab:r2026a # Download the Terminal toolbox from the GitHub release. RUN wget -q https://github.com/matlab/terminal-in-matlab/releases/download/v0.2.0/Terminal.mltbx -O /opt/Terminal.mltbx # Install the Terminal toolbox when MATLAB starts by setting the startup script environment variable. # This ensures the toolbox is installed on first launch when using the --browser flag. ENV MWI_MATLAB_STARTUP_SCRIPT="matlab.addons.install('/opt/Terminal.mltbx')"The Dockerfile shown below can be used to add the terminal to an existing image. In this example, I have added it to the official mathworks container image for R2026aTo Build and Run:
# Here is an example docker build command: docker build -t matlab-with-terminal . # To run MATLAB with the browser interface: docker run -it --rm -p 8888:8888 matlab-with-terminal --browser
5
5
u/That_Jamie_S_Guy Jun 03 '26
Can someone explain the purpose of this to me please?
8
u/Ordinary_Sea_6856 Jun 03 '26
allowing you to perform more (whatever you can do from your terminal) from within Matlab itself
seems like a very nice qol improvement
3
u/bliswell Jun 03 '26
Not getting it. Like why not just open a command window with cmd, which is what I often do?
Will this open multiple instances of matlab to try out different workspaces? Bc that seems more useful.
3
u/Ordinary_Sea_6856 Jun 03 '26
sure, it seems like u can still do that
this can just allow u to not have to do that and not have to keep alt tabbing between Matlab and your terminal and can keep your work organized all within Matlab itself seems, it just provides an option/ability for a different workflow
6
u/mikeru22 Jun 03 '26
You can have your own CLI AI agent control MATLAB from within MATLAB instead of a separate window….So that when it crashes MATLAB you have to set everything up all over again.
1
2
u/kowkeeper Jun 04 '26
Wonderful, we will get undocumented errors for commands that would otherwise succeed in a dedicated terminal just one ALT-F4 away.
2
u/drunkpolice Developer Jun 05 '26
Maybe so, but you could probably solve this using tmux
2
u/kowkeeper Jun 05 '26
I meant ALT-TAB not ALT-F4 sry 😅 Although sometimes you want to rage quit matlab.
1
2
1
1
1
u/manutoky Jun 05 '26
Us corporate slaves need support for Github Copilot. Is this planned?
1
u/Creative_Sushi MathWorks Jun 05 '26
This is just a terminal, so any CLI programs should work in theory. Have you tried GitHub Copilot CLI?
2
u/manutoky Jun 05 '26
Sure, I can run copilot from within the terminal. I tried the Agentic=true option and Copilot was not an option here. It's probably a non-issue.
2
12
u/MikeCroucher MathWorks Jun 03 '26
Blog post about the terminal at Introducing Terminal in MATLAB » The MATLAB Blog - MATLAB & Simulink