Practical 2: Variables, Script M-files and Graphing
Script M-files
Exercise
> Open a new script M-file by clicking on New Script while in Home tab. A new window will be opened. It has three tabs: Editor, Publish and View. To create, save, run, and edit your M-file you need to stay in the Editor tab. > From now on every M-file should start with comment headers that include your name and student ID as well as a description of the purpose of the code as follows: % Practical 2 Graphing exercise % <Add your name, student ID and today’s date here> > Add in the commands: clear all x=2^3 > Save your M-file, for example, as prac2e1.m in your preferred directory and make sure that the Current Folder in MATLAB is set to the same location. > Enter command prac2e1 (or whatever name you saved your M-file as) in the Command Window. It should execute your M-file code. Please, note absence of the file extension .m |
|
![]() |