It won't be long before your programs are too long and you get tired of entering everything on the command line. Fire up your favourite text editor (or use the built-in Matlab editor) and write a sequence of Matlab commands (remember to use ``;'' at the end of each line to suppress the output). Save the file with whatever name you wish mfilename , but make sure to include a ``.m'' extension, that is, mfilename.m . You can call your script from the command prompt with the name of the file (without the .m extension).
>> mfilename