View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 1.32 KB File ID: #40142 Version: 1.1




01 Feb 2013 (Updated )

transpose_structure(s) transposes all the fields in the structure. useful for later cat(1,s.field)

| Watch this File

File Information

Users that often use cat(1,s.field) find annoying that this function generates error if the field is in different orientation (row or column vector). Instead of try ... catch, it's suggested to use transpose_structure(s).

>> s = struct('x',ones(10,1),'y',zeros(5,1));
>> s = transpose_structure(s)

Required Products MATLAB
MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
05 Feb 2013 Jan Simon

Jan Simon (view profile)

This line considers only all elements of the inputs struct s, when it is a vector:
for i = 1:length(s)
To consider all elements in arrays using linear indexing:
for i = 1:numel(s)

Comment only
05 Feb 2013 1.1

replaced length() by numel()

Contact us