Abstract

In this chapter we’ll see how to make choices as to whether statements are executed or not, and how to choose between or among statements. The statements that accomplish this are called selection or branching statements. The MATLAB® software has two basic statements that allow us to make choices: the if statement and the switch statement. The if statement has optional else and elseif clauses for branching. The if statement uses expressions that are logically true or false. These expressions use relational and logical operators. MATLAB also has a menu function that presents choices to the user; this will be covered at the end of this chapter.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.