From the course: Learning MATLAB

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Arrays and matrices

Arrays and matrices - MATLAB Tutorial

From the course: Learning MATLAB

Arrays and matrices

- [Instructor] In the previous video we talked about variables and their data types. Now let's see how we can create variables that store arrays and matrices. You can represent any variable as an array, row, or column or as a matrix with a certain number of rows and columns. To create an array in MATLAB, you have to separate elements with a comma or space and put them in rectangular brackets. Now let's create a variable called array one which will contain five elements in a row and we'll have the rectangular bracket first and then one, zero, two, four, five and conclude with the brackets. And if we hit enter, we will see in the command window, the array, which is one by five array. So it's one row and five columns. And also we notice this in the workspace. We can also use the same array, which is again, one by five or we can create the same array, which will be using the same elements but separated by comma. So array…

Contents