You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
When manipulating multidimensional matrices, there might be situations that requires swapping (permute) and merging dimensions (reshape). This function simplifies the code and performs the swapping and merging in one function call.
y = permuteMerge(x, dims);
x: input matrix
dims: Cell array indicating how dimensions are to be permuted and merged. Each cell defines an output matrix dimension in the order that is supplied. Specify multiple elements in a cell to merge specific input matrix dimensions.
e.g. permuteMerge(x, {[4 3],[1 2]})
- Rearrange 4D matrix dimensions in the order [4 3 1 2] (@permute)
- Merge dimensions [4 3] and [1 2] to form a 2D output matrix.
Cite As
Spencer Chen (2026). permuteMerge(x, dims) (https://www.mathworks.com/matlabcentral/fileexchange/48415-permutemerge-x-dims), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.0.0.0 (1.36 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.0.0.0 |
