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

Refer to matrix and vector elements - MATLAB Tutorial

From the course: MATLAB 2018 Essential Training

Start my 1-month free trial

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