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

Versión 1.1.0.0 (1,62 KB) por DS
INVERSE_CAT splits a given data array into sub-arrays along the specified dimension.
449 descargas
Actualizado 10 abr 2012

Ver licencia

[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.

Citar como

DS (2024). Reverse concatenation: separate a data array along a specified dimension. (https://www.mathworks.com/matlabcentral/fileexchange/36097-reverse-concatenation-separate-a-data-array-along-a-specified-dimension), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2007b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y MATLAB Answers.

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.1.0.0

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

1.0.0.0