From the course: Learning MATLAB
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Create and manipulate variables - MATLAB Tutorial
From the course: Learning MATLAB
Create and manipulate variables
- [Instructor] Like many programming languages, the MATLAB language provides mathematical expressions which can involve entire matrices. When MATLAB encounters a new variable name, it immediately creates the variable and the appropriate amount of storage. If the variable name already exists, it changes its content, and, if necessary, allocates new storage. For example, a = 10 creates a one-by-one matrix named a and stores the value 10 in its single element. Or you can create a variable that has more than one constant, instead has a range of values. MATLAB allows you to do that by using the colon between the minimum and maximum value. For example, if we want to store numbers from 1 to 10 in a step of one in variable a, then we type a = 1:10, and press Enter. If the step is not one but any other number, we have to specify the step value. For example, if the step is two, then we have to write a = 1:2 for the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.