File Exchange

image thumbnail

bsxcat(dim, varargin)

version (1.94 KB) by Bruno Luong
Concatenate two arrays along a specific dimension with auto expansion of singleton enabled.

1 Download

Updated 20 Dec 2016

View Version History

View License

Insert the zeros-row on top of 3x3 matrix
M = magic(3)
Concatenate the ones-column on right of 3x3 matrix
M = magic(3)

Cite As

Bruno Luong (2021). bsxcat(dim, varargin) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Bruno Luong

Felipe, thanks good suggestion


I'd only make it compatible with cat.m by modifying the first and last lines as follows:

function C = bsxcat(dim, A, B, varargin)

if (nargin > 3), C = bsxcat(dim, C, varargin{:}); end

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!