No BSD License  

Highlights from
Sort Structure

2.0

2.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 1.46 KB File ID: #1958

Sort Structure

by Mark Jobse

 

12 Jul 2002 (Updated 23 Jul 2002)

Sort fields in ascending order.

| Watch this File

File Information
Description

It really bugged me that MATLAB automatically adds a new field in a structure at the end of that structure.

This function remedies that problem. After you add a new field, just sort it with this function and everything is put into the right order again.

Notice that this function also sorts the structures within the structures and puts them at the beginning, before the other fields.

Acknowledgements
This submission has inspired the following:
Order all fields
MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
07 Feb 2006 Duane Hanselman

For MATLAB 6.5 (R13) and later see the function orderfields

30 Mar 2008 Paul de jong

Using this function removes all data-arrays from your structure except for the first entry. Be carefull!

Please login to add a comment or rating.
Updates
12 Jul 2002

Bug

Tag Activity for this File
Tag Applied By Date/Time
structures Mark Jobse 22 Oct 2008 06:46:30
cell arrays Mark Jobse 22 Oct 2008 06:46:30
structure Mark Jobse 22 Oct 2008 06:46:30
sort Mark Jobse 22 Oct 2008 06:46:30
sorting Mark Jobse 22 Oct 2008 06:46:30
utilities Mark Jobse 22 Oct 2008 06:46:30
sorting CaseyB 21 Jul 2009 13:05:42
cell arrays Malgorzata Plechawska 06 Aug 2009 19:32:43
structure fandkkk 22 Oct 2009 01:47:14
structure Thimeau 04 Oct 2011 08:12:43

Contact us at files@mathworks.com