Generate view of MATLAB file in specified format
publish(
generates a view of
the specified MATLAB® code file and output in an HTML format that can be used for
sharing. file
)publish
saves the HTML file and a file for each
graphic that the code creates in a subfolder named html
. The
location of the html
subfolder is relative to the location of
file
.
For example, publish('C:\myMATLABfiles\myfile.m')
runs the
code in myfile.m
using the base workspace, and then saves the
formatted code and results in
C:\myMATLABfiles\html\myfile.html
.
publish(
generates a view of the specified MATLAB file with options specified by one or more
file
,Name,Value
)name,value
pair arguments.
publish(
uses the file
,options
)options
structure to generate the view of the
specified MATLAB file. Using a structure to specify options is useful when you want
to preconfigure and save your options for repeated use. The fields and values of
the options
structure correspond to names and values of
name-value pair arguments.
To enhance the readability of the published document and include additional image snapshots, external file content, and external images, see Publishing Markup.
The publish
function does not include formatted text when
generating a view of a live script or a live function (.mlx
).
To generate a view of the entire live script or live function, export the file
instead. On the Live Editor tab, in the
File section, click Export
and select from the available export options.
For more information, see Share Live Scripts and Functions.