This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Basic program files

Scripts are the simplest type of program file. They are useful for automating a series of MATLAB® commands, such as computations that you have to perform repeatedly from the command line or series of commands you have to reference.


edit Edit or create file
input Request user input
publish Generate view of MATLAB file in specified format
grabcode Extract MATLAB code from file published to HTML
snapnow Force snapshot of image for inclusion in published document


Create Scripts

Create a script in a new file or from commands in the Command History.

Add Comments to Programs

Add comments to describe your code and allow others to understand it.

Run Code Sections

Define code sections within your MATLAB program files to evaluate each section individually.

Scripts vs. Functions

Program files can be scripts that simply execute a series of MATLAB statements, or they can be functions that also accept input arguments and produce output.

Add Functions to Scripts

Add functions to scripts to reuse code within a script and avoid creating and managing separate function files.

Options for Presenting Your Code

MATLAB provides options for presenting your code to others.

Publishing MATLAB Code

Add markup to your code to create a formatted document that includes your code, comments, and output.

Publishing Markup

Prepare MATLAB comments for publishing, including using HTML and LaTeX markup, and displaying external files and graphics.

Output Preferences for Publishing

Publish a MATLAB file including specifying input argument values and properties for publishing by using publish configurations.

Was this topic helpful?