To overcome this problem matlab allows us to type all the commands in a file and execute at one time like a batch file. These files are called Script Files or M-Files. Before executing the Script File one must set the path of the Directory. Save the file as script.m and execute it,the result i.e. cost is displayed at the command is displayed. Some Utility functions which can be used in script files.
Displays result without identifying the variables.
Control the command window echoing the script file commands Input Prompt input from the user. Pause until user presses any keyboard key. Pause for n seconds ,then continue Waitforbuttonpress Pause until user presses mouse button or keyboard key. Use disp function to suppress the variable name at the command . In the process the commands evaluated by the function and the variables used in the intermediate process are hidden .Similarly we can write user defined functions and use them .