No License
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.
Cite As
Mark Jobse (2024). Sort Structure (https://www.mathworks.com/matlabcentral/fileexchange/1958-sort-structure), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Language Fundamentals > Data Types > Structures >
- MATLAB > Language Fundamentals > Matrices and Arrays > Shifting and Sorting Matrices >
Tags
Acknowledgements
Inspired: Order all fields
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |