Lab: Scripts

Created

Scripts


Script Files

A script file (*.m) allows you to put all your commands in a text file and then execute the file.

  • Able to include basic programming constructs (loops, decision statements)
  • Commands are executed sequentially.
  • Execute script files by typing the name of the file at the prompt. (>> Image_processing to run Image_processing.m).
  • Put all script files for a project in the directory the session presides in.

Single line comments start with a % and block comments start with %{ and end with %}.

Steps to create a script file called Image_processing.m

  1. change pwd: >> cd C:\...\... to the folder where your file will be saved.
  2. Launch Matlab editor from the toolbar.
  3. Save as Image_processing.m.