Welcome to the lesson on scripts in MATLAB. During this lesson, I'll show you how to create a script and how to run it, as well as explain what a script is. So a script in MATLAB is the most basic type of program that you can write. Is simply a list of sequential commands, function, calls, and variable declarations in MATLAB. So there are two primary ways of creating scripts, The first is using the command line where you can type edit and then your script name, so I'll call this myScript, and when you hit enter, because it doesn't exist yet you have this dialogue asking you if you want to create it, and so I'm just gonna click Yes, and it opens up an Editor. The other way, is to go to your Toolstrip, HOME, and then you can click New Script, you can click New Script, or you can go to Open, I'm sorry, or you to New, click Script, and then it'll open the same editor. Unlike with functions a new script doesn't contain any skeleton code, and so everything you put in your script will be from scratch. So what I'm gonna do here is create a script that defines four different arrays, and then it is going to place all of the arrays into a cell, and then it's going to loop over each array in the cell and pass a it into the stats function, that will return the mean and the standard deviation of the elements in each array. So the first thing we want to do here is type clear which clears your workspace of all variables, and then clc which clears your Command Window of all commands. Next we're going define our arrays. So array a will just be an array of 1s with one row and three columns, array b will be an array of values 1 through 7, array c will be an array of random values, both positive and negative, and then array d will be an array of positive and negative decimal values. So now that we have this, we wanna put all of these arrays in some sort of structure that we can iterate over, and so I'm going to create a cell called matrices, and I'm gonna set it equal to arrays a, b, c, and d. The next thing I'm gonna do is create a for loop that iterates over each case. So for i is equal to 1, to the length of matrices. So basically this is saying for the range of 1 to however many matrices there are in the cell array, in this case four, you're going to iterate over each case. And so I'm gonna define data within the loop as cell to map which converts the element or the array within the cell to a matrix or one dimensional array, so that matrix and array operations can be performed. And so once we do this, we're simply just going to call our function, But because this returns two values, we have to be sure that we're using two values to unpack it. And so once again, this returns the mean and the standard deviation. So I'm using m and s, and then the function is called stats and we just pass our data into there. Finally, we're going to display our values along with some text explaining what we're seeing, and so using the display command, I'm just gonna type The mean is:, and then I'm gonna display the mean, then I'm going to type the standard deviation is: and display the standard deviation. And then like all loops and functions we want to end with the end command. So once I do this I'm going to save it, and then I can close out. So if you go to your current folder panel you can see your myScript script here, and all we wanna do to call it is use the run command, so run myScript, and as you can see here, it prints for each case, so the first one, the mean is 1, the standard deviation is 0. For the second, the mean is 4, the standard deviation is 2. For the third, the mean is 1.2000, and the standard deviation is 3.8678, and finally, for the last one, the mean is 3.9149, and the standard deviation is 9.3486. So to recap, instead of typing each of these individual commands or passing in an array to your stats function, we wrote a script that iterates over all the cases, and prints and displays the values along with some text describing what that value represents. This concludes this lesson, thank you.