Be the first to rate this file! 6 Downloads (last 30 days) File Size: 1.3 KB File ID: #41776

TransposeMat - like transpose, but handles N-D arrays

by Chad Webb

 

16 May 2013 (Updated 16 May 2013)

Transposes the rows/columns (only) on any N-dimensional array

| Watch this File

File Information
Description

Matlab provides 'transpose' for 2-D arrays and 'permute' for N-D arrays. This is just a very basic interface that chooses the correct one to use for the situation, but ONLY ever transposes rows/columns.

Required Products MATLAB
MATLAB release MATLAB 7.10 (R2010a)
Tags for This File  
Everyone's Tags
data exploration, earth science, matrix, optimization, simulation
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
17 May 2013 Jan Simon

This would be a more compact one-liner:

out = permute(in, [2, 1, 3:ndims(in)]);

Updates
16 May 2013

Fixed bugs for non-square matricies

Contact us