Ways to Share and Export Live Scripts and Functions
R2026bYou can share live scripts and functions with others for teaching or demonstration purposes, or to provide readable, external documentation of your code.
This table shows the different ways to share live scripts and functions.
| Ways to Share | Instructions |
|---|---|
| Share file directly. | Distribute the live code file. Recipients of the file can open and view it in MATLAB® in the same state that you last saved it, including any generated output. If the file is saved using the
plain text live code file format ( |
Export file to documents viewable outside of MATLAB. Supported formats include:
| To export your live script or function interactively, on the Live Editor tab, select Export and then select a format. To export all of the live scripts and functions in a folder, on the Live Editor tab, select Export > Export Folder. In the Export dialog box that opens, you can customize the export options. (since R2023b)
For more information about the different export options,
see the corresponding name-value arguments for the The converted file closely resembles the appearance of the live script or function with output inline. If the live script contains controls or tasks, MATLAB saves them as code in the converted file. When exporting to LaTeX, MATLAB creates a separate Alternatively, you can use the |
To export your live script or function programmatically, use
the When using the
| |
| Show the files as a full-screen presentation. | Open the live script or function. Then, go to the View tab and click the Full Screen button on. Alternatively, you can use the Ctrl+F11 keyboard shortcut. On macOS, use the Command+F11 keyboard shortcut instead. To exit full-screen mode, move the mouse to the top of the screen to display the View tab and click the Full Screen button off. You also can use the Exit fullscreen button at the top-right of the screen. |
Hide Code Before Sharing
Before sharing or exporting your live scripts, consider hiding the code. When you hide the code, only output, labeled controls, tasks, and formatted text appear in the live script. If a task in the live script is configured to show only code and no controls, then the task does not display when you hide the code. Hiding the code is useful when sharing if you want others to change only the value of the controls in your live script or when you do not want others to see your code.
To hide the code, click the Hide code button to the right of the live script. You also can go
to the View tab, and in the View section,
click Hide Code
. To show the code again, click the Output inline
button or the Output on right button
. Alternatively, if you are using the export function to share your live script, you can hide the code
using the HideCode name-value argument.
Note
When exporting to PDF, Microsoft Word, HTML, LaTeX, Markdown, or Jupyter notebooks, MATLAB saves controls and tasks as code. If you have a live script that contains controls and tasks and you hide the code before exporting, the converted file does not contain the controls or tasks.