| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
C = cat(dim, A, B)
C = cat(dim, A1, A2, A3, A4, ...)
C = cat(dim, A, B)concatenates the arrays A and B along dim.
C = cat(dim, A1, A2, A3, A4, ...)concatenates all the input arrays (A1, A2, A3, A4, and so on) along dim.
cat(2, A, B) is the same as [A, B], and cat(1, A, B) is the same as [A; B].
When used with comma-separated list syntax, cat(dim, C{:}) or cat(dim, C.field) is a convenient way to concatenate a cell or structure array containing numeric matrices into a single matrix.
Given
A = B =
1 2 5 6
3 4 7 8
concatenating along different dimensions produces

The commands
A = magic(3); B = pascal(3); C = cat(4, A, B);
produce a 3-by-3-by-1-by-2 array.
vertcat, horzcat, strcat, strvcat, num2cell, special character []
![]() | cast | catch | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |