Block transposition, permutation, and reshaping of arrays
Version 1.1.4 (12,6 ko) par
Matt J
Analogues for transpose(), reshape(), and permute() but where sub-blocks of the array are treated as scalar elements.
MATLAB provides various functions like permute(), transpose(), and reshape() allowing one to change the dimensions of an array and reorder its elements. At times, however, I find I wish to do things similar to these, but where instead of reordering the individual scalar entries of an array, certain sub-blocks are treated as the "elements". Thus, for instance, if A, B, C, and D are matrices of the same size and M=[A B;C D] is a block matrix, I would like to transpose the block positions to obtain M=[A C; B D] but without reordering the contents of the sub-matrices A,B,C, and D themselves.
This FEX submission contains a set of files for doing just this kind of thing. The assumption throughout is that the sub-blocks are equal-sized sub-tiles of the given array. The tools work on any MATLAB array that can be reshaped and permuted in N-dimensions. They will also work for sparse matrices if you download my ndSparse class.
The usage of these tools is demonstrated in the Examples tab.
Citation pour cette source
Matt J (2024). Block transposition, permutation, and reshaping of arrays (https://www.mathworks.com/matlabcentral/fileexchange/115340-block-transposition-permutation-and-reshaping-of-arrays), MATLAB Central File Exchange. Extrait(e) le .
Compatibilité avec les versions de MATLAB
Créé avec
R2021b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
Version | Publié le | Notes de version | |
---|---|---|---|
1.1.4 | Fixed bug in ndSparse support |
||
1.1.3 | Fixed bug in blkReshape, triggered when target dimensions are given as comma-separated list. |
||
1.1.2 | Small documentation fix. |
||
1.1.1 | Typo correction. |
||
1.1.0 | Added blkSize, blkLength, blkNumel for dimension querying |
||
1.0.0 |