Programming Previous page   Next Page

Working with M-Files

MATLAB provides a full programming language that enables you to write a series of MATLAB statements into a file and then execute them with a single command. You write your program in an ordinary text file, giving the file a name of filename.m. The term you use for filename becomes the new command that MATLAB associates with the program. The file extension of .m makes this a MATLAB M-file.

This section covers

Types of M-Files

M-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.

MATLAB scripts:

MATLAB functions:


Previous page  Checking It In Basic Parts of an M-File Next page

© 1994-2005 The MathWorks, Inc.