Common form of the switch statement, MATLAB in Mathematics

Common form of the switch statement:

The common form of the switch statement is as shown below:

 

switch switch_expression

  case caseexp1

   action1

  case caseexp2

   action2

  case caseexp3

   action3

  % etc: there can be many of these

  otherwise

   actionn

end

 

The switch statement begins with the reserved word switch, and ends with reserved word end. switch_expression is compared, in series, to the case expressions (caseexp1, caseexp2, etc.). If the value of the switch_expression matches the caseexp1, for illustration, then action1 is executed and the switch statement ends. If the value matches caseexp3, then the action3 is executed, and in common if the value matches caseexpi, where i can be any of the integer from 1 to n, then actioni is executed. When the value of the switch_expression does not match any of the case expressions, the action is taken after the word or else is executed.

Posted Date: 10/19/2012 3:22:45 AM | Location : United States







Related Discussions:- Common form of the switch statement, Assignment Help, Ask Question on Common form of the switch statement, Get Answer, Expert's Help, Common form of the switch statement Discussions

Write discussion on Common form of the switch statement
Your posts are moderated
Related Questions
how can reconstruct just part of an image using imreconstruct?

Empty Vectors: An empty vector or in another words, a vector which stores no values, can be generated using the empty square brackets: >> evec = [] evec = [] >> lengt

Example of Logical built-in functions: For equivalent to all the function, we should make sure that the entire elements in the vector are logically true. The one way of doing

Histogram: The histogram is a particular type of bar chart which shows the frequency of occurrence of the values within a vector. The Histograms use what are known as bins to

Nested IF-ELSE statements: The if-else statement is used to select between the two statements. In order to select from more than two statements, the if-else statements can als

Script a MATLAB program which meets the following speci cations: The program expects an input of a two-variable real-valued continuous function f : R^2--> R The program is to cal

Types of User-defined Functions: We know how to write a user-defined function, stored in an M-file, which computes and returns one value. This is merely one type of the functi

Polar Form: Any complex number z = a + bi can be thought of as a point (a,b) or vector in the complex plane in which the horizontal axis is the real part of z, and the vertica

Referring to and Modifying the Matrix Elements: To refer to matrix elements, the row and then the column indices are given in parentheses (always the row index initially and t

If I have a vector representing the packed storage form of a symmetric matrix, how do I perform a cholesky factorisation on that?