publish
Generate view of MATLAB file in specified format
Syntax
Description
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.
Examples
Input Arguments
Name-Value Arguments
Limitations
Publishing live scripts or functions is not supported. To convert live scripts or functions to other formats, use the
exportfunction instead.Publishing a MATLAB code file (
.m) by calling thepublishfunction from a live script or function (.mlx) is not supported.The
publishfunction does not support theinputfunction. Publishing a MATLAB code file (.m) that contains a call to theinputfunction results in an error.
Tips
To enhance the readability of the published document and include additional image snapshots, external file content, and external images, see Publishing Markup.
To avoid duplicate snapshots when publishing MATLAB code files, make sure that your cursor is not positioned over any figures before calling the
publishfunction. Having the cursor on a figure can cause the figure to update and thepublishfunction to generate duplicate snapshots.