Matlab Script File and Function Comparison

  • Both could be written using “New Script”
  • Both save as .m file
  • In function, the first line is function definition line
  • The variables in a function file are local. The variables in a script file are recognized in the command window.
  • When a function file is saved, the name of the file should be the same as the name of the function.