Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Now enter the above three statements in the editor (you can be lazy like me and copy-and-paste from the Command History; hold down the Ctrl-key to select multiple statements simultaneously). In addition add the clear all and clc commands at the top to start with a clean slate.

Save this file: File > Click on the Save icon
Enter beam.m for  for File name. M-Files need to have .m as the suffixThis will create a .m (script) file. Make sure you are saving into your working directory. Click Save.

...

Let's say we don't want the values of A and B reported each time we run this program. To suppress the reporting of A and B values, add a semi-colon at the end of the statements for creating A and B. Image Removed Image Added
Save and run the program again, this time using the Run icon in the Editor. Check the result in the Command window.
Add comments to your program to lay out, in a human language, what it does. Comments are prefixed with a %; See below.

...