Versions Compared

Key

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

...

We'll create a MATLAB program to calculate R using the above three statements. Nothing fancy here: the program will just be a text file with the above statements. Such a file is called a Script File and have the filename extension .m . Let's take a peek at the documentation on Script files. Go in Help > Documentation and search for  Script Script.

Click on the first hit and glance through this section for future reference. Also search for  Working for Working with files and folders.

Let's now create a Script file and simultaneously bring up the Editor. From the Home tab, selectselect New Script.

First, note that you can dock and undock the editor by clicking on the Show Editor Actions iconImage Added,  located in the top right corner of the Editor window. Notice that the editor tabs merges with the three default tabs when the Editor window is docked. 

Now .In the Editor, 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 > Save

...