ABSTRACT

MATLAB® executes the instructions in the same sequence as they are input. The fi rst instruction is executed fi rst, the second instruction is executed second, and so on, and the last instruction is executed last. In this chapter, MATLAB commands, which will allow a program to change the normal execution sequence, are introduced. The fl ow control in a MATLAB program can be altered by relations, logical expressions, and branching instructions. As a result, a computer program can execute different sequences of instructions depending on the condition set. Relational and logical operations allow the comparison of variables, and based on their results the transfer and selection of a pathway to satisfy a particular condition can be accomplished. For example, if statement A is true, then the program executes the instructions B, C, and D, but if not, then the program executes instructions E, F, and G instead.