Like the built-in function 'cat', this function concatenates arrays along a specified dimension. However, when the other dimensions of the input arrays do not match, nonexisting values are padded with a specified value.
C = CAT2(dim, padval, A, B)
C = CAT2(dim, padval, A1, A2, A3, A4, ...)
Examples:
C = cat2(3, 0, ones(3, 3, 1), 2*ones(4, 4, 2));
C = cat2(3, {[]}, cell(3, 3, 1), cell(4, 4, 2));
For convenience, horzcat2 and vertcat2 are also provided.
Cite As
Peter H (2026). cat2 (https://www.mathworks.com/matlabcentral/fileexchange/52722-cat2), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2014a
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Creating and Concatenating Matrices in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
