This can be done when you upload a submission to File Exchange (aka. FEX). You will need to:
- publish your M-file to HTML using the PUBLISH command (or button). This generates a folder "html".
- zip together the following:
- 1. the M-file,
- 2. the "html" folder,
- 3. optional: any other files and folders for that submission.
- upload the ZIP file to FEX.
If you do not include both the M-file and the "html" folder then it will not work. Do not change the filenames.
Note that multiple HTML files (and their associated images) can be included in the "html" folder!
Tip: download any FEX submssion with HTML examples and unzip it to see the "html" folder.