Use of AI to Generate Matlab Code


Inspired in part by Christmas Trees, I'm curious about people's experience using AI to generate Matlab code.
1. Do you use AI to generate production code or just for experimentation/fun code?
2. Do you use the AI for a complete solution? Or is it more that the AI gets you most of the way there and you have to apply the finishing touches manually?
3. What level of quality would you consider the generated code? Does it follow "standard" Matlab coding practices? Is it well commented? Factored into modular functions? Argument checking? Memory efficient? Fast execution? Etc.?
4. Does the AI ever come up with a good or clever solution of which you wouldn't have thought or maybe of which you weren't even aware?
5. Is it easy/hard to express your requirements in a manner that the AI tool effectively translates into something useful?
6. Any other thoughts you'd care to share?
Toshiaki Takeuchi
Toshiaki Takeuchi on 12 Jan 2026 at 15:31
  1. Currently I am using it for fun/experiment, but I know people on software development space using it for production. In the hardware engineering side, there may be pockets of experiments going on, but not sure about production code.
  2. I am using Research/Plan/Implement (RPI) approach, investing upfront in research and planning phase, and that seem to work very well and the implementation phase gets much more smooth. I shared videos on LinkedIn that showcase this approrach (creating 3D Saturn, creating a flyby animation, committing to a repo, and creating an interactive app) . I still review the documents AI generates and test the code it generates, but I don't manually fix the code in general. With MATLAB MCP Core Server, AI generally follows the coding guidlines well.
  3. With the RPI approach, the generated code looks pretty good for what I need. If you want to get more, you need to add those requirements lsike modularity, argument checking, etc. in the requirement document.
  4. In the RPI process, AI asks clarifying questions, and that can be very constructive to nudge me to think more deeply to frame the problem better.
  5. In the RPI process, I communicate my goals and requirements and iterate on them with AI, and let AI generate the documents. Hence the documents are already formatted in a way useful for AI to understand.
  6. For now, I am focused on using AI to prototype ideas. Pitching ideas to others can be time consuming, and even with an excellent PowerPoint deck, it is not easy to communicate ideas. If you demo your ideas with actual working prototypes, that would make those ideas more tangible and accesible. I believe that alone is very useful in accelerating our work.
Duncan Carlsmith
Duncan Carlsmith on 6 Jan 2026
I find AI-assisted coding amazing,expecially now with an MCP server connecting AI directly to MATLAB so the AI can test and debug, pivot stratagies/approaches, while you simply watch the process. See How to set up and use AI Desktp Apps with MATLAB and MCP servers and my other recent posts at the Generative AI discussion forum.
James
James on 23 Dec 2025
I only use AI as a search engine, because that is basically all that current AI does. It is an advanced search enginer that can write sentences instead of lists. Because of that it appears to write code. It is not true AI and because it does not learn from its mistakes.
xingxingcui
xingxingcui on 23 Dec 2025
AI-generated code is getting better and better and has become indispensable at work. However, the native MATLAB Copilot™ experience in the MATLAB desktop ENV is much worse than using Copilot in VS Code, so I have to strike a balance between the two.