Programming and Data Types    

Creating M-Files: Accessing Text Editors

M-files are ordinary text files that you create using a text editor. MATLAB provides a built-in editor, although you can use any text editor you like.

Another way to edit an M-file is from the MATLAB command line using the edit function. For example,

opens the editor on the file foo.m. Omitting a filename opens the editor on an untitled file.

You can create the fact function shown on the previous page by opening your text editor, entering the lines shown, and saving the text in a file called fact.m in your current directory.

Once you've created this file, here are some things you can do:


  Providing Help for Your Programs Scripts