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.

Define string variables

Define string variables - MATLAB Tutorial

From the course: MATLAB 2018 Essential Training

Start my 1-month free trial

Define string variables

- [Instructor] MATLAB's main strength is its ability to perform advanced mathematical operations quickly. However, you do need to communicate your results clearly, and that often means using text. In this movie, I will show you how to create text variables, which MATLAB stores as strings. I've started MATLAB and I have an empty command window, and I'll just start by defining a single string variable. So I'll type V-A-L one, and then equal sign for assignment, and to indicate a string, you use a single quote. So I'll type a single quote and then the number seven, and close it with a single quote. You might notice that the string value seven, including the single quotes in which it was enclosed, appears in magenta rather than black, and that's a way that MATLAB indicates that you've created a string. So I'll press Enter, and val1 has seven, and again enclosed in single quotes to indicate it's a string. If I were to create val2 and set that equal to single quote degrees and follow that…

Contents