MATLAB Flow Control Structures
摘要
Interactive programming format is illustrated in the previous chapter, where sequential execution of the statements is demonstrated. The MATLAB mechanism runs the commands line by line. In real applications, sometimes the execution order of the commands may need to be controlled according to certain conditions. For instance, it may need to execute a piece of code repeatedly for a certain number of times. In this chapter, loop structures, conditional structures, switch structures and trial structures are presented. Vectorized programming style is demonstrated.