Al momento, stai seguendo questo contributo
- Vedrai gli aggiornamenti nel tuo feed del contenuto seguito
- Potresti ricevere delle email a seconda delle tue preferenze per le comunicazioni
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 .
Cita come
Duncan Carlsmith (2026). Generate MATLAB Code Using ChatGPT API (https://it.mathworks.com/matlabcentral/fileexchange/125220-generate-matlab-code-using-chatgpt-api), MATLAB Central File Exchange. Recuperato .
Informazioni generali
- Versione 1.01 (433 KB)
Compatibilità della release di MATLAB
- Compatibile con qualsiasi release
Compatibilità della piattaforma
- Windows
- macOS
- Linux
