File Exchange

image thumbnail

explorestruct

version 1.0 (198 KB) by

MATLAB Utility for exploring structures and plotting its fields.

3.88889
19 Ratings

11 Downloads

Updated

View License

Editor's Note: This file was a File Exchange Pick of the Week

CRC-ExploreStruct v.1.1
MATLAB Utility for exploring structures and plotting their fields.

This GUI is an updated and enhanced version of the StructBrowser utility submitted to MATLAB Central in May 2003. It comes with new interface and an enhanced display. It uses Microsoft TreeView control to display and explore any kind of MATLAB structures. The CRC ExploreStruct was designed to expose the contents of the array struct to any depth and plot any of the components. This tool is very useful for programmers using structures in their code.

Comments and Ratings (25)

Luke Plausin

Luke Plausin (view profile)

This is a really great piece of work but it seems like development activity has stopped. I have modified this package to work in version R2012a without any warnings.

http://www.mathworks.com/matlabcentral/fileexchange/52375-explorestruct-1-2

Fabrice

Does not work with latest Matlab/Java versions

Lennart

does not work any more

Andrew Bliss

Andrew Bliss (view profile)

Looks like some updates are in order. I'm getting the following warnings and error using version 2011a. I don't have time today to troubleshoot.

Warning: This undocumented function will be replaced in a future release.
To continue to use it, add 'v0' as its first argument, followed by its normal calling sequence.
> In uitreenode at 73
In explorestruct at 29
Warning: This undocumented function will be replaced in a future release.
To continue to use it, add 'v0' as its first argument, followed by its normal calling sequence.
> In uitree at 106
In explorestruct at 30
Warning: Possible deprecated use of set on a Java object with an HG Property 'UserData'.
> In explorestruct at 37
Warning: Possible deprecated use of get on a Java object with an HG Property 'UserData'.
> In explorestruct at 71
Warning: Possible deprecated use of set on a Java object with an HG Property 'ActionPerformedCallback'.
> In explorestruct at 73
Warning: Possible deprecated use of set on a Java object with an HG Property 'ActionPerformedCallback'.
> In explorestruct at 75
Warning: Possible deprecated use of set on a Java object with an HG Property 'ActionPerformedCallback'.
> In explorestruct at 77
??? There is no 'UIContextMenu' property in the 'com.mathworks.hg.peer.UITreeNode' class.

Error in ==> explorestruct at 83
set(root,'UIContextMenu', cmenu);

Hassan,

Extremely nice tool!
There is a tiny bug in the subfunction getcNodevalue.
Replace
d = findstr(field,'(');
and
idx = str2num(field(d+1));

with
d = findstr(field,'(');
d_e = findstr(field,')');
idx = str2num(field(d+1:d_e-1));

as else the structure will not correctly refresh for structures >(9*1).

Best regards,
Patrice

It also works in R2009a when you modify the lines 28 to 31
You have to add a first argument 'v0' to line 83 as mentionned Martin Römpert ... but also for EACH line with uitreenode . It will prevent warnings in a standalone mode (MATLAB Compiler). These warnings tell you to add v0 to continue to use this undocumnted feature (uitreenode). I made this modification and now there is no warning at all when I expand my nodes.

So, with Tobias' fix (above), this is working nicely. Thanks to the author and to Tobias.

Got it for R2008b!

First, add 'v0' to the uitreenode and uitree commands. Second, pause the execution of the m-file after the uitree command by approx. 0.1 seconds (could depend on your computer). To this, replace the code from line 28 to 31 by

set(h, 'Name', fig_name);
root = uitreenode('v0', name, name, [], false);
tree = uitree('v0', 'Root', root, 'ExpandFcn', @myExpfcn4);
pause(0.1)
set(tree, 'Units', 'normalized', 'position', [0 0 0.35 1]);

I've got the same problems as Michael Ashby in R2008b (7.7.0.471): the left side is missing.

Does anyone have a fixed version?

Michael Ashby

add to comment above...

Matlab version 7.7.0

Thanks

Michael Ashby

I am unable to get this to work, even on the demo.

The GUI is displayed but is missing the left side completely. No error messages. I am running 2008a.

Any advice please?

Martin Römpert

Excellent tool ...

@ Michael Miller(mmiikkee@comcast.net)
Date: 2007-08-02

Change line 83 ff to:
% set(root,'UIContextMenu', cmenu);
t = tree.Tree;
set(t,'UIContextMenu', cmenu)

Jagadeesh K

How to highlight a particular node of the tree?
or
How to setfocus on a particular node of the tree?

Jagadeesh K

Suppose, the tree is huge and if i provide the user to enter the text in editbox and a search button to search for the text.And on click of the search button, if the entered text is present in the tree, then that Node has to be highlighted.How can this functionlity be achieved?

Eric Lee

A good tool!
Note: I made a small change to line 182, to avoid the need to copy the exp_struct_icons directory. This may make the tool more portable.

% pth = [matlabroot, '\work\exp_struct_icons\'];
pth = [fileparts(mfilename('fullpath')) '\exp_struct_icons\']

Michael Miller

Not compatible with latest version of Matlab (R2007a). The following error occurs even when you run the demo.
>> es_demo
??? There is no 'UIContextMenu' property in the 'com.mathworks.hg.peer.UITreeNode' class.

Error in ==> explorestruct at 83
set(root,'UIContextMenu', cmenu);

83 set(root,'UIContextMenu', cmenu);
K>>

Ami Drory

I like it, but it would be good to extend this tool to be able to explore classes, cells etc.

Hans van Lint

I liked StructBrowser, but this one doesn't work for me. I get a message:

??? Error using ==> explorestruct>myExpfcn4
The uitree node type is not recognized. You may need to define an ExpandFcn for the nodes.

Any one with suggestions???

Daniel Eottevenyi

Very good tool, but there is a bug in line 264 (sometimes false data will be shown unless it is replaced):
if(field(d+2)==')')
idx = str2num(field(d+1));
else
if(field(d+3)==')')
idx = str2num(field(d+1:d+2));
else
idx = str2num(field(d+1:d+3));
end
end

Francis Pieraut

Doesn't work

viktor trogrlic

doesn't work in Matlab Rel. 13!
What can I do to make it work on rel. 13?

Brett Shoelson

This is a nice tool that provides a convenient way to visualize structures. I was keen on using it with ExcelFileSummary; it works, but it seems to have a limited viewing depth for nested structures. Still, very nice.

Taoufik Mbarek

Gerd Kunert

The tool seems to be quite useful.
Two comments:
a) replace line 247 by
fields{length(fields)+1, 1} = cNode.getValue;
such that exlorestruct also works with Matlab 7.0.1.

b) For variables that can be displayed in a single line (such as a string), it would be useful to display the variable content as well (not only in the Matlab window)

MATLAB Release
MATLAB 7.0.1 (R14SP1)
Acknowledgements

Inspired: explorestruct 1.2

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

» Watch video

Win prizes and improve your MATLAB skills

Play today