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
Illustration of Variance For illustration, for the vector [4, 6, 1, 5], there are n = 4 values therefore n - 1 is 3. The mean of this data set is also 4. The variance will be

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


Recursive Functions: The Recursion occurs whenever something is defined in terms of itself. In the programming, a recursive function is a function which calls itself. The Recu

Refer the subset of a matrix: It is also possible to refer to the subset of a matrix. For illustration, this refers to the first & second rows, second & third columns: >> m

Illustration of Spreadsheet Files: This reads the numbers in a double vector variable nums and the text in a cell array txt (the xlsread function forever returns the numbers f

strvcat function - concatenation: The function strvcat will concatenate it vertically, that means that it will generate a column vector of the strings.   >> strvcat(fir

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

Built-in functions for Complex numbers:   We know that in MATLAB both i and j are built-in functions which return √-1 (therefore, they can be thought of as built-in constants).

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