From the course: MATLAB 2018 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Refer to matrix and vector elements - MATLAB Tutorial
From the course: MATLAB 2018 Essential Training
Refer to matrix and vector elements
- [Instructor] You will frequently store MATLAB data in vectors and matrices. While in most cases you will refer to those vectors and matrices as a whole, you can also refer to individual elements within them. I'll show you how to do that in this movie. I have just started MATLAB and I am in a clear command window. If you're referencing a value in a vector, you can just do a linear reference to the position. So, for example, if I were to create a variable called vector one, vec1, equal, and then after a left square bracket, I would provide the range of values from eight to 14. So eight colon 14, followed by right square bracket and Enter, and I see my vector with all of those values. If I want to display the first value, I can type vec followed by a left parentheses, the number one, and then a right parentheses and Enter. Oh, I'm sorry, the variable name should've been vec1, so MATLAB suggested the replacement, so I'll press Enter, and I get the number eight, which is indeed the first…
Contents
-
-
-
-
Define vectors and matrices5m 56s
-
(Locked)
Refer to matrix and vector elements3m 25s
-
(Locked)
Overview of matrix multiplication2m 56s
-
(Locked)
Perform matrix multiplication2m 14s
-
(Locked)
Perform scalar and element-wise operations on vectors and matrices6m 27s
-
(Locked)
Use vectors and matrices in a function5m 54s
-
(Locked)
Generate special matrices5m 1s
-
(Locked)
Transpose and find the inverse of matrices5m 47s
-
-
-
-
-
-