Generate MATLAB Code Using ChatGPT API

版本 1.0.1 (432.6 KB) 作者: Duncan Carlsmith
Generates a commented MATLAB Live Script using the OpenAI API for ChatGPT.
2.2K 次下载
更新时间 2023/4/1

查看许可证

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.

引用格式

Duncan Carlsmith (2026). Generate MATLAB Code Using ChatGPT API (https://ww2.mathworks.cn/matlabcentral/fileexchange/125220-generate-matlab-code-using-chatgpt-api), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2022b
兼容任何版本
平台兼容性
Windows macOS Linux

GenerateMATLABCodeUsingChatGPTAPI

版本 已发布 发行说明
1.0.1

add link to related scripts

1.0.0