horzcat

Class: matlab.mixin.Heterogeneous
Package: matlab.mixin

Horizontal concatenation for heterogeneous arrays

Syntax

C = horzcat(A1,A2,...)

Description

C = horzcat(A1,A2,...) concatenates the matlab.mixin.Heterogeneous objects A1, A2, and so on, to form the array C. All input arrays must have the same number of rows.

The class of object arrays A1,A2,... must be derived from the same root class of a matlab.mixin.Heterogeneous hierarchy.

MATLAB® calls:

C = horzcat(A1,A2,...)

for the expressions:

C = [A1,A2,...]
C = [A1 A2 ...]

when A1 is an array of matlab.mixin.Heterogeneous objects.

If all input arguments are of the same specific class, the class of the resulting array is unchanged. If all input arguments are of different subclasses of a common superclass that is derived from matlab.mixin.Heterogeneous, then the result is a heterogeneous array. The array's class is that of the most specific superclass shared by all input arguments.

If all input arguments are not members of the same heterogeneous hierarchy, MATLAB calls the convertObjects method, if defined by the dominant root class (the first argument or the left-most element in the concatenation if no other class is dominant).

The horzcat method is sealed in the class matlab.mixin.Heterogeneous and, therefore, you cannot override it in subclasses.

Input Arguments

A1

Object array of class matlab.mixin.Heterogeneous

A2

Object array of class matlab.mixin.Heterogeneous

Output Arguments

C

Array resulting from the specified concatenation. The class of this array is that of the most specific superclass shared by the input arguments.

Attributes

Sealedtrue

To learn about attributes of methods, see Method Attributes in the MATLAB Object-Oriented Programming documentation.

Was this topic helpful?