Programming |
Dot-Dot-Dot (Ellipsis) -- ...
The ellipsis is the line continuation operator in MATLAB.
Line Continuation
Continue any MATLAB command or expression by placing an ellipsis at the end of the line to be continued:
Entering Long Strings. You cannot use an ellipsis within single quotes to continue a string to the next line:
To enter a string that extends beyond a single line, piece together shorter strings using either the concatenation operator ([]
) or the sprintf
function.
quote1 = [ 'Tiger, tiger, burning bright in the forests of the night, ' ... 'what immortal hand or eye could frame thy fearful symmetry?']; quote2 = sprintf('%s%s%s', ... 'In Xanadu did Kubla Khan a stately pleasure-dome decree, ', ... 'where Alph, the sacred river, ran ', ... 'through caverns measureless to man down to a sunless sea.');
Dot-Parentheses -- .( )
Use dot-parentheses to specify the name of a dynamic structure field.
Dynamic Structure Fields
Sometimes it is useful to reference structures with field names that can vary. For example, the referenced field might be passed as an argument to a function. Dynamic field names specify a variable name for a structure field.
The variable fundtype
shown here is a dynamic field name:
See Using Dynamic Field Names for more information.
Exclamation Point -- !
The exclamation point precedes operating system commands that you want to execute from within MATLAB.
Shell Escape
The exclamation point initiates a shell escape function. Such a function is to be performed directly by the operating system:
See Shell Escape Functions for more information.
Parentheses -- ( )
Parentheses are used mostly for indexing into elements of an array or for specifying arguments passed to a called function.
Array Indexing
When parentheses appear to the right of a variable name, they are indices into the array stored in that variable:
Function Input Arguments
When parentheses follow a function name in a function declaration or call, the enclosed list contains input arguments used by the function:
Comma -- , | Percent -- % |
© 1994-2005 The MathWorks, Inc.