Main Content


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.


editEdit or create file
inputRequest user input
publishGenerate view of MATLAB file in specified format
grabcodeExtract MATLAB code from file published to HTML
snapnowTake snapshot of image for inclusion in published document


Basic Programs

Adding Inputs and Output

  • Scripts vs. Functions
    Code 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.

Sharing Code

Related Information