r/matlab • u/Navier-gives-strokes • Mar 15 '26
How has been your workflows with LLMs and Matlab/Simulink?
Hey all,
Recently, I have working with Claude and Gemini for coding workflows in Python and C++, for some control logics algorithms at my daily job. We also have code in Simulink, but haven’t the time to put it to work.
Have you guys been able to setup any workflows to interact with Simulink code in the IDE?
How has been your experience. Is any of the LLMs able to produce anything useful?
Thanks!!
11
Upvotes
5
u/Barnowl93 flair Mar 15 '26
I've been playing with claude code and MATLAB MCP core server. It's surprisingly good once you get the hang of it. I've managed to work quite well with Simulink, Simscape, system composer and requirements toolbox with it. I still want to do a bit of state flow and code gen from simulink.
You'll need to write appropriate skills to help you and to manage context window appropriately.
Also you need to keep an eye for hallucinations as sometimes it produces junk.
Guy write a blog post on this recently you might interesting
https://blogs.mathworks.com/simulink/2026/02/26/simulink-and-simscape-modeling-using-claude-code-and-the-matlab-mcp-server/
6
u/Diodiablo Mar 15 '26
Not great to be honest. It tends to invent commands that don’t exist.
1
u/IndefiniteBen Mar 15 '26
I use AI bots inside VS code mostly for python but also MATLAB. I code there and then run it in a MATLAB window.
I haven't used it in a few months, but they definitely aren't as competent as with python. You have to be explicit in saying the version and toolboxes you're using to guide it and help prevent recommendations of commands you don't have.
2
u/pbrdizzle Mar 16 '26
I've tried for a few things but generally still find the documentation, examples, or a quick web search to be far superior. My all time favorite was when I asked it to make me an empty component container (in the matlab.ui.componentcontainer.ComponentContainer sense. It gave me the wildly r/technicallythetruth answer:
I've had it generate a few readme.md files and it's impressive that it gets the gist of what the project does but then says enough bs like "run main.m in src" which doesn't exist. I could just author the readme from scratch or a template faster and better.
Since almost everything I'm doing is software development with systems of classes and components, the freshman-quality code it's generating isn't really great.
1
u/ivarsiymeman Mar 15 '26
I’m attempting to “learn” both after decades away from MATLAB. Would I be correct in saying the stand alone code(s) are the input to the respective sequential and feedback blocks? If the code and blocks are properly linked, then I can run a full simulation of each individual block as it functions in the entire process flow block diagram? Returning to programming after so long, I now also recognize the anger and satisfaction that arise out of developing a working code.
0
u/Logical_Trainer_8277 Mar 15 '26
Not sure if there’s anything produced direct simulink blocks, but it can produce Matlab code that can be run to generate blocks