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.
In MATLAB
Online, you cannot use the publish
function on a
file in your Shared
folder. To publish a shared file, open
the file in the Editor, and then click Publish on the
toolbar. When you use the Publish button in MATLAB
Online instead of the publish
function, MATLAB stores the results in the Published
subfolder
of your root folder instead of the html
subfolder.
To enhance the readability of the published document and include additional image snapshots, external file content, and external images, see Publishing Markup.