Code covered by the BSD License  

Highlights from
ShowStructTree.m

4.0

4.0 | 1 rating Rate this file 7 Downloads (last 30 days) File Size: 1.37 KB File ID: #41301

ShowStructTree.m

by

 

Display the fields of a structure as a tree.

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.12 (R2011a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
07 May 2013 Marcel RĂ¼land

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}]);
end
Thank you

17 Apr 2013 Jan Simon

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

a.b = 15
s = 'b'
disp(a.(s))

Contact us