Code covered by the BSD License  

Highlights from
Graphically display the 'branch' structure of a struct variable

4.5

4.5 | 3 ratings Rate this file 10 Downloads (last 30 days) File Size: 1.7 KB File ID: #32879
image thumbnail

Graphically display the 'branch' structure of a struct variable

by Andrew

 

13 Sep 2011

Recursive function designed to display the 'branch' structure of struct variables.

| Watch this File

File Information
Description

Welcome to my first post!

Recursive function 'structstruct.m' accepts a single input of any class and outputs ASCII to the command window. Currently no function outputs.

For non-structure input, structstruct displays the class and size of the input and then exits. For structure input, structstruct displays the fields and sub-fields of the input in an ASCII graphical printout in the command window. The order of structure fields is preserved.

Has header and commented 'help' text with INPUT/OUTPUT info. Code is decently commented.

I designed this function so I could easily explore the structure of a struct variable without 'digging' through all the fields in the Variable Editor. It serves its purpose very well, but there are surely areas for expanded/improved functionality that I'm not seeing...

Comments and suggestions welcome!

MATLAB release MATLAB 7.11 (R2010b)
Tags for This File  
Everyone's Tags
display, explore, struct, structure
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
21 Nov 2011 mostafa saeed  
28 Oct 2011 mostafa saeed

think's for you. great work

04 Oct 2011 nan

This works really well.

I decided I wanted to display the contents of singletons and strings, instead of their size and type, since I'm storing metadata in complex structures. That update was easy to add, a couple of lines checking the size and type. The original will also be useful when I really just want the structure itself.
Thanks for sharing this, Andrew.

Contact us