Main Content


Class: matlab.mixin.Heterogeneous
Namespace: matlab.mixin

Horizontal concatenation for heterogeneous arrays


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


C = horzcat(A1,A2,...,An) concatenates two or more matlab.mixin.Heterogeneous object arrays (A1, A2, and so on) to form the array C. The input arrays must have the same number of rows.

When A1, A2, and so on are arrays of matlab.mixin.Heterogeneous objects, MATLAB® calls horzcat for these types of statements.

C = [A1,A2,...]
C = [A1 A2 ...]
  • If all input arguments are of the same 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 class of the final array is 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 leftmost element in the concatenation if no other class is dominant). For more information, see Converting Nonmember Objects.

Input Arguments

expand all

Object arrays to concatenate. The input arrays must have the same number of rows.



To learn about attributes of methods, see Method Attributes.

Version History

Introduced in R2011a