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
Illustrations of Variable number of output arguments: In the illustrations shown here, the user should actually know the type of the argument in order to establish how many va

Writing variables to a File: The save command is used to write variables to a file, or to append the variables to a MAT-file. By the default, save function writes to a MAT-fil

Applications of Customized Strings: Labels, Prompts, Arguments to Functions: The one of very useful application of this is to involve numbers in strings that are used to plot

How do I write a product series running from i to n of x''s using a for loop?

Function fopen - file function: The permission string in the call to the fopen function identifies that the file is opened for writing to it. Just as when reading from a file,

Program of built-in factorial function: Calling this function yields similar result as the built-in factorial function: >> fact(5) ans =   120 >> factorial(

Matrix of Plots: The other function which is very useful with any type of plot is subplot that creates a matrix of plots in the present Figure Window. The three arguments are

Functions to create special matrices: The MATLAB also has various functions which create special matrices. For illustration, the zeros function generates a matrix of all zeros

Concatenation: The String concatenation means to join the strings altogether. Of course, as strings are merely vectors of the characters, the technique of concatenating vector

Three-Dimensional Plots: The MATLAB has many functions which will display three-dimensional plots. Most of these functions have similar name as corresponding two-dimensional p