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.
Use is statements - MATLAB Tutorial
From the course: MATLAB 2018 Essential Training
Use is statements
- [Instructor] Now that I'm in MATLAB, I have a blank command window, and I can start working with the commands and functions that I described. I don't need to create a script. I can just work here. I'll start by defining a string variable, so I'll call it str1, equals, and then in single quotes, card, and Enter. So there's my assignment. Let's say I want to check to see if this is a character string, so str1 is a character string. I would use ischar, followed by left parentheses and str1, the name of the variable. Right parentheses, Enter, and I get a logical one, so the value is true. String one does in fact contain a character string. I can also determine whether individual characters are letters. To do that, I would use isletter, and then in parentheses, str1, and Enter. And I get a logical array. So I see that I have four elements in the array, in the vector, and all of them have a one, which means that they are all letters. And if I look at C-A-R-D, that makes sense. If I create…
Contents
-
-
-
-
-
-
Include if and if-else statements in a script7m 28s
-
(Locked)
Apply conditional logic using Switch5m 26s
-
(Locked)
Examine values using the is statements3m 21s
-
(Locked)
Use is statements3m 45s
-
(Locked)
Perform operations multiple times using for loops7m 29s
-
(Locked)
Perform operations while a specific condition is true5m 19s
-
-
-
-