Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

;, :, _stmtseq

Statement sequences

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

object1; object2; ...
object1: object2: ...
_stmtseq(object1, object2, …)

Description

The function call _stmtseq (object1, object2, ...) is equivalent to the statement sequence (object1; object2; ...).

The function call _stmtseq (object1, object2, ...) evaluates the statements (object1; object2; ...) from left to right.

_stmtseq () returns the void object of type DOM_NULL.

Examples

Example 1

Usually, statements are entered imperatively:

x := 2; x := x^2 + 17; sin(x + 1)

This sequence of statements is turned into a single command (a “statement sequence”) by enclosing it in brackets. Now, only the result of the “statement sequence” is printed. It is the result of the last statement inside the sequence:

(x := 2; x := x^2 + 17; sin(x + 1))

Alternatively, the statement sequence can be entered via _stmtseq. For syntactical reasons, the assignments have to be enclosed in brackets when using them as arguments for _stmtseq. Only the return value of the statement sequence (the return value of the last statement) is printed:

_stmtseq((x := 2), (x := x^2 + 17),  sin(x + 1))

Statement sequences can be iterated:

x := 1: (x := x + 1; x := x^2; print(i, x)) $ i = 1..4

delete x:

Parameters

object1, object2, …

Arbitrary MuPAD® objects and statements

Return Values

Return value of the last statement in the sequence.

See Also

MuPAD Functions

Was this topic helpful?