Join Patrick Royal for an in-depth discussion in this video Control flow, part of Learning MATLAB.
Let's investigate the conveyance used in MATLAB to set up loops, conditional …statements and other changes to the flow of the program. …For this lesson open up the conditionals.m MATLAB file in exercise files. …Conditional statements in MATLAB use the same IF-ELSE command structure as in many …other programming languages. In the conditionals.mscript, our goal is …to test whether matrix a is invertible before we try to invert it, if a is not …invertible, we want to transpose it instead.…
To accomplish this, I'll put an IF statement before line two. …The only way for this matrix to be non-invertible is if the 3,3 term in the …matrix is equal to 3. So in our if statement, we put, if a of …3,3 equals equals 3. We use double equal signs here because we …are using a comparison rather than attempting to assign a value to a variable.…
Now when I bring the Transpose command onto this line and press Enter, it will …be indented indicating that it is part of the if statement, and will only be …executed if the condition is true. Next, I'll add the line else to tell …
- Installing MATLAB
- Working with MATLAB variables
- Working with matrix and scalar operations
- Creating functions
- Understanding performance considerations
- Building basic plots
- Creating responsive programs
- Editing variables manually
- Working with the Statistics Toolbox
Skill Level Intermediate
PHP with MySQL Essential Trainingwith Kevin Skoglund14h 32m Beginner
1. General Concepts
2. Core MATLAB Syntax
3. Programming in MATLAB
4. Data Representations
5. External Toolboxes
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.