They operate on data in the workspace. Functions, which can accept input arguments and return output arguments.
Internal variables are local to the function.
Scripts can operate on existing data in the workspace, or they can create new data on which to operate. Although scripts do not return output arguments, any variables that they create remain in the workspace, to be used in subsequent computations. In addition, scripts can produce graphical output using functions like plot . After execution of the file is complete, the variables n and r remain in the workspace. Functions Functions are M-files that can accept input arguments and return output arguments.