File Exchange

image thumbnail


version 1.0 (1.37 KB) by

Display the fields of a structure as a tree.

1 Download


View License

Some functions that I use, especially ones that read complicated file types, produce complicated structures with many sub fields. This function displays the structure and all of the sub fields as an ascii tree in the command line terminal.

It does NOT actually show the contents of the fields, just the names of the fields.

Comments and Ratings (2)

This is a nice tool: simple and helpful. For very large structs it becomes slightly unclear. For a better overview I don't show the leave nodes by nesting line 27 with an if statement:
if isstruct(run.(namesout{x}))
ShowStructTree(eval([a(1).name '.' namesout{x}]),[toprint '.' namesout{x}]);
Thank you

Jan Simon

Jan Simon (view profile)

There is no need to use the evil EVAL! "Dynamic fieldnames" work for over 10 years now:

a.b = 15
s = 'b'

MATLAB Release
MATLAB 7.12 (R2011a)

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

» Watch video