3. Script M-files

As has been mentioned already, for simple problems it is easy to enter your requests after the prompt in the MATLAB Command Window. However, as the number of commands increases or whenever you wish to make major changes, this becomes very tedious. Instead, you should place MATLAB commands in a simple text file, and then tell MATLAB to open the file and evaluate all the commands precisely as it would if you had typed them after the prompt. These files are called script M-files and must have filenames ending with the extension ’.m’. Examples of possible M-file names are example1.m, proj1Y2000.m, question5.m, mechdevice.m, etc.