Generate MATLAB Code Using ChatGPT API
Version 1.0.1 (433 KB) von
Duncan Carlsmith
Generates a commented MATLAB Live Script using the OpenAI API for ChatGPT.
This script uses OpenAI's API for ChatGPT to ask for MATLAB code in English, writes the code to a .m file which may be opened and saved as a .mlx. Using the API side-steps browser-based access to OpenAI and copy-pasting into MATLAB.
This script is based on a template at <https://www.mathworks.com/matlabcentral/answers/1894530-connecting-to-chatgpt-using-api> . Thank you! I've only added a few lines to prepare the text output for ready conversion to Live Script form and included in the prompt an ask for some specific code lines. Also, I upped the number of tokens.
To use this script, open and receive an API secret key at https://platform.openai.com/account/api-keys.
See and like my related scripts at https://www.mathworks.com/matlabcentral/fileexchange/?q=carlsmith&sort=date_desc_submitted .
Zitieren als
Duncan Carlsmith (2024). Generate MATLAB Code Using ChatGPT API (https://www.mathworks.com/matlabcentral/fileexchange/125220-generate-matlab-code-using-chatgpt-api), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Erstellt mit
R2022b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS LinuxTags
Quellenangaben
Inspiriert: Access Mathematica and ChatGPT-generate MATLAB code via APIs, Generate unit-tested ChatGPT MATLAB codes, Autonomous Collaborative between GPT and MATLAB, MATLAB Code Generation - ChatGPT versus Bard, Translate Python To MATLAB With ChatGPT Programmatically
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
GenerateMATLABCodeUsingChatGPTAPI
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.0.1 | add link to related scripts |
||
1.0.0 |