Ahora está siguiendo esta publicación
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
This Live Script generates multiple MATLAB Live Scripts with a "plain English" prompt using the ChatGPT API. It extends of the code Generate MATLAB Code Using ChatGPT API to generate multiple codes and unit tests each one for executability. The number of trials is selectable. One can break when a first successful code passes an "able to execute" minimal test, illustrating just what might be possible. More sophisicated testing and script creation may be added using MATLAB's text scan and manipulation tools.
This script repeatedly prompts OpenAI's API for ChatGPT to ask for MATLAB code, and writes each code to a .m file in the default folder which may be opened and saved as a .mlx.
Each time ChatGPT is called, it responds with a different script. The script may or may not generate a figure. It may or may not execute due to a minor syntax error. This script can be used to filter out buggy responses so the user to focus on more important things.
To use this script, open a free account and and receive an API secret key at https://platform.openai.com/account/api-keys.
See and like related scripts at https://www.mathworks.com/matlabcentral/fileexchange/?q=carlsmith&sort=date_desc_submitted
Citar como
Duncan Carlsmith (2026). Generate unit-tested ChatGPT MATLAB codes (https://es.mathworks.com/matlabcentral/fileexchange/125565-generate-unit-tested-chatgpt-matlab-codes), MATLAB Central File Exchange. Recuperado .
Agradecimientos
Inspirado por: Generate MATLAB Code Using ChatGPT API
Inspiración para: Access Mathematica and ChatGPT-generate MATLAB code via APIs, Autonomous Collaborative between GPT and MATLAB, Drag and drop PDF to MATLAB conversion with ChatGPT, Code Generation Comparison for MATLAB - ChatGPT versus Bard
Información general
- Versión 1.01 (4,1 MB)
Compatibilidad con la versión de MATLAB
- Compatible con cualquier versión
Compatibilidad con las plataformas
- Windows
- macOS
- Linux
