Question: what is the difference between the matlab command window and a script file?
Answer: You cannot use mfilename in the command window . You cannot pause execution in the command window . In r2016b and later you can define scripts in script files . With newer matlab releases you can use the editor interface to pause a script .