Reverse concatenation: separate a data array along a specified dimension.

INVERSE_CAT splits a given data array into sub-arrays along the specified dimension.

您现在正在关注此提交

[A B]=INVERSE_CAT(DIM,C) splits array C along dimension, DIM, returning sub-arrays A and B.

Examples:
M = [1 2 3; 4 5 6; 7 8 9];
C = cat(2,M,M)
[A B] = inverse_cat(2,C) ... returns A=M and B=M
[A B] = inverse_cat(1,rot90(C)) ... returns A=rot90(M) B=rot90(M)
[A B] = inverse_cat(3,cat(3,M,M)) ... returns A=M and B=M

-----
Note: There are certainly more efficient ways to separate concatenated data. Suggestions for improvement are much appreciated.

*Thanks to Jan Simon for insightful comments.

引用格式

DS (2026). Reverse concatenation: separate a data array along a specified dimension. (https://ww2.mathworks.cn/matlabcentral/fileexchange/36097-reverse-concatenation-separate-a-data-array-along-a-specified-dimension), MATLAB Central File Exchange. 检索时间: .

类别

Help CenterMATLAB Answers 中查找有关 Creating and Concatenating Matrices 的更多信息

一般信息

MATLAB 版本兼容性

  • 兼容任何版本

平台兼容性

  • Windows
  • macOS
  • Linux
版本 已发布 发行说明 Action
1.1.0.0

Added Jan Simon's method to handle dimensions > 3.

1.0.0.0