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

Versione 1.1.0.0 (1,62 KB) da DS
INVERSE_CAT splits a given data array into sub-arrays along the specified dimension.
447 download
Aggiornato 10 apr 2012

Visualizza la licenza

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

Cita come

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

Compatibilità della release di MATLAB
Creato con R2007b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.1.0.0

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

1.0.0.0