Format Files in the Live Editor
You can add formatted text, hyperlinks, images, and equations to your live scripts and
functions to create a presentable document to share with others.
To insert a new item, go to the Insert tab and select from the available options:
Option Description Additional Details
Code
Insert a blank
line of code.
You can insert a code line before, after, or between text
lines.
Section
Break
Insert a
section break.
You can insert a section break to divide your live script or
function into manageable sections to evaluate individually.
A section can consist of code, text, and output. For more
information, see “Run Sections in Live Scripts” on page 19-
14.
Text
Insert a blank
line of text.
A text line can contain formatted text, hyperlinks, images,
or equations. You can insert a text line before, after, or
between code lines.
Table of
Contents
Insert a table
of contents.
The table of contents contains a list of all the titles and
headings in the document. Only the title of the table of
contents is editable.
You can add a table of contents only in text lines. If you
insert a table of contents into a code line, MATLAB places
it directly above the current code section.
Code
Example
Insert a
formatted
code example.
A code example is sample code that appears as indented
and monospaced text.
Select Plain to insert sample code as unhighlighted text.
Select MATLAB to insert sample code as text highlighted
according to MATLAB syntax.
Image
Insert an
image.
You can add images only in text lines. If you insert an
image into a code line, MATLAB places the image in a new
text line directly under the selected code line.
19 Live Scripts and Functions