No BSD License  

Highlights from
Structure outline

4.8 | 13 ratings Rate this file 11 Downloads (last 30 days) File Size: 18.9 KB File ID: #13500 Version: 1.0

Structure outline


B. (view profile)


28 Dec 2006 (Updated )

Prints the hierarchy outline of a structure with optionally, field values.

| Watch this File

File Information

This function prints the hierarchical outline of a structure to the command window or a file. Optionally, field values can be printed as well.

type "help strucdisp" for more information about this function.


Display Structure inspired this file.

This file inspired Printstruct | Recursively Print Structures To The Command Window Or A Cell Char Array.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (15)
04 Aug 2015 Ethan P  
29 Oct 2014 Chris

Chris (view profile)

works fine, made a small addition

if nargin < 5 || isempty(fileName)

if (nargout < 1)
% write data to screen
for i = 1 : length(listStr)
disp(cell2mat(listStr(i, 1)));

and added listStr as an output so the calling function can get the structure text back rather than only printing it to the CommandWindow. Need this so I can dump the structure to a PPTX file.

14 Mar 2014 Stefan

Stefan (view profile)

Great tool! I changed field(iFieldElement) to Field(iFieldElement) in line 294 to make it work for me (probably a typo).

31 May 2011 Roger Parkyn

Worked for me.

19 Oct 2010 Matt Brunner

Awesome! Exactly what I was looking for. Thank you.

24 Jun 2009 Joseph

Joseph (view profile)

This is really great. Good job.

28 May 2009 Benjamin  
06 Mar 2009 Mais

Mais (view profile)

very useful

03 Apr 2008 Juergen Kurzmann

This is a really helpful function for getting a concise overview of data structures (struct) as well as for their documentation!

08 Mar 2008 B. Roossien

I've fixed a number of bugs and added some improvements following feedback from Holger Krause and Juergen Kurzmann. The new file should be available in 2-3 days.

Comment only
05 Feb 2008 Rahul Y D

thank you very much really helpful function

23 Jan 2008 Holger Krause

I'm using this function to print out nicely formatted log files containing parameters of various types. strucdisp is just the right tool for this job.

There are three smaller issues:

1. It would be nice, to handle logicals separately (output as text 'true' or 'false' at least for single values).

2. The line for numeric vectors is missing a space in front of the opening bracket.

3. In some cases empty fields get duplicated and occur one time as an empty string '' and a second time as an empty double array [ ].

10 May 2007 B. Roossien

This function has been updated. Some bugs were fixed. Its performance is enhanced and new functionalities (printing small matrices and handling structure arrays) have been added.

Comment only
09 Jan 2007 John D'Errico

Problem resolved. My new rating is now the correct one.

This will be a useful utility for those of us who sometimes generate complicated structures.

08 Jan 2007 John D'Errico

I do like this utility, but there is a significant bug. The help states that all arguments but the first are optional. I tried passing in the third argument, but not the second, supplying an empty argument to the second as a placeholder. This should be acceptable. Its also the standard way that Matlab tools use to allow some arguments to be defaulted.

??? Operands to the || and && operators must be convertible to logical scalar values.

Error in ==> strucdisp>get_fields at 151
if (depth < 0) || (indent + 1 < depth)

Error in ==> strucdisp at 64
liststr = get_fields(structure, 0, depth, flag_value, max_length);

Arguments that take on a default value should test for empty values provided using isempty, and if empty, then provide the default.

I'd have rated this a 5 otherwise, and I will happily raise my rating to that level if it is repaired.

09 Jan 2007

Bug fix following the feedback provided by John D'Errico

08 May 2007

added new functionalities and increased perfomance.

Contact us