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.

., _concat

Concatenate objects

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.


object1. object2
_concat(object1, object2, …)


object_1.object_2 concatenates two objects.

_concat( object1, object2, ...) concatenates an arbitrary number of objects.

_concat( object1, object2) is equivalent to object1. object2. The function call _concat( object1, object2, object3, ...) is equivalent to (( object1. object2). object3). ... . _concat() returns the void object of type DOM_NULL.

The following combinations are possible:

object1object2object1. object2

E.g., x.1 creates the identifier x1.

Note that the objects to be concatenated are evaluated before concatenation. Thus, if x := y, i := 1, the concatenation x.i produces the identifier y1. However, the resulting identifier y1 is not fully evaluated. Cf. Example 2.


Example 1

We demonstrate all possible combinations of types that can be concatenated. Strings are produced if the first object is a string:

"x"."1", "x".y, "x".1, "x".f(a)

Identifiers are produced if the first object is an identifier:

x."1", x.y , x.1, x.f(a)

The concatenation operator . also serves for concatenating lists:

[1, 2] . [3, 4]

L := []: for i from 1 to 10 do L := L . [x.i] end_for: L

delete L:

Example 2

We demonstrate the evaluation strategy of concatenation. Before concatenation, the objects are evaluated:

x := "Val": i := ue: x.i

ue := 1:  x.i

An identifier produced via concatenation is not fully evaluated:

delete x: x1 := 17: x.1, eval(x.1)

The . operator can be used to create variables dynamically. They can be assigned values immediately:

delete x: for i from 1 to 5 do x.i := i^2 end_for:

Again, the result of the concatenation is not fully evaluated:

x.i $ i= 1..5


delete i, ue: (delete x.i) $ i = 1..5:

Example 3

The function _concat can be used to concatenate an arbitrary number of objects:

_concat("an", " ", "ex", "am", "ple")

_concat("0", " ".i $ i = 1..15)

_concat([], [x.i] $ i = 1..10)



A character string, an identifier, or a list

object2, …

A character string, an identifier, an integer, a list, or an expression

Return Values

Object of the same type as object1.

Overloaded By

object_1, object_2

See Also

MuPAD Functions

Was this topic helpful?