cat2

Version 1.0.0.0 (1.17 KB) by Peter H
Concatenate arrays of dissimilar/inconsistent sizes
87 Downloads
Updated 28 Aug 2015

View License

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 Linux
Categories
Find more on Creating and Concatenating Matrices in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0