## Concatenation Examples

### Combining Single and Double Types

Combining `single` values with `double` values yields a `single` matrix. Note that `5.73*10^300` is too big to be stored as a `single`, thus the conversion from `double` to `single` sets it to infinity. (The `class` function used in this example returns the data type for the input value).

```x = [single(4.5) single(-2.8) pi 5.73*10^300] x = 4.5000 -2.8000 3.1416 Inf class(x) % Display the data type of x ans = single ```

### Combining Integer and Double Types

Combining integer values with `double` values yields an integer matrix. Note that the fractional part of `pi` is rounded to the nearest integer. (The `int8` function used in this example converts its numeric argument to an 8-bit integer).

```x = [int8(21) int8(-22) int8(23) pi 45/6] x = 21 -22 23 3 8 class(x) ans = int8```

### Combining Character and Double Types

Combining `character` values with `double` values yields a `character` matrix. MATLAB® converts the `double` elements in this example to their `character` equivalents:

```x = ['A' 'B' 'C' 68 69 70] x = ABCDEF class(x) ans = char ```

### Combining Logical and Double Types

Combining `logical` values with `double` values yields a `double` matrix. MATLAB converts the `logical` `true` and `false` elements in this example to `double`:

```x = [true false false pi sqrt(7)] x = 1.0000 0 0 3.1416 2.6458 class(x) ans = double ```