Development Environment    

Running Programs

Running M-Files

Run M-files, files that contain code in the MATLAB language, the same way that you would run any other MATLAB function. Type the name of the M-file in the Command Window and press Enter or Return.

To display each function in the M-file as it executes, use the Display preference and check Echo on, or use the echo function set to on.

Interrupting a Running Program

You can interrupt a running program by pressing Ctrl+c or Ctrl+Break at any time.

On Windows platforms, you may have to wait until an executing built-in function or MEX-file has finished its operation. On UNIX systems, program execution will terminate immediately.

Running External Programs

The exclamation point character, !, is a shell escape and indicates that the rest of the input line is a command to the operating system. Use it to invoke utilities or run other programs without quitting from MATLAB. On UNIX, for example,

invokes the vi editor for a file named darwin.m. After you quit the program, the operating system returns control to MATLAB. See the functions unix and dos to run external programs that return results and status.

Opening M-Files

To open an M-file, select the file or function name in the Command Window, and then right-click and select Open Selection from the context window. The M-file opens in the Editor/Debugger.

Examining Errors

If an error message appears when running an M-file, move the cursor on the error message and press the Enter or Return key. The offending M-file opens in the Editor, scrolled to the line containing the error.


 Printing Command Window Contents Keeping a Session Log