Syntax:
hFig = uiinspect(obj)
Description:
UIINSPECT inspects an object handle (e.g., Java, COM, Handle Graphics, Matlab class, Dot-Net etc.) and displays the inspection results in a unified Matlab window. UIINSPECT displays a unified window with all relevant object methods (as can be displayed via Matlab's methodsview function), properties (as can be displayed via Matlab's inspect function), static fields, and callbacks. UIINSPECT also displays properties and fields that are not normally displayed with Matlab's inspect function. Property meta-data such as type, accessibility, visibility and default value are also displayed.
Unlike Matlab's inspect function, multiple UIINSPECT windows can be opened simultaneously.
Object properties and callbacks may be modified interactively within the UIINSPECT window.
hFig = UIINSPECT returns a handle to the created figure window. UIINSPECT opens a regular Matlab figure window which may be accessed via hFig (unlike Matlab's methodsview function which opens a Java frame that is not easily accessible from Matlab).
Examples:
hFig = uiinspect(0); % Matlab root (desktop) handle
hFig = uiinspect(handle(0));
hFig = uiinspect(gcf); % Figure handle
hFig = uiinspect(handle(gcf));
uiinspect(get(gcf,'JavaFrame'));
uiinspect(classhandle(handle(gcf))); % UDD handle
uiinspect(findprop(handle(gcf),'MenuBar')); % Meta-data handle
uiinspect('java.lang.String'); % Java class name
uiinspect(java.lang.String('yes')); % Java class object reference
uiinspect(actxserver('Excel.Application')); % COM/ActiveX object
uiinspect(Employee) % Matlab class object
uiinspect(?handle) % Matlab metaclass object
uiinspect('meta.class') % Matlab class name
uiinspect(System.Diagnostics.Process.GetCurrentProcess) % Dot-Net object
Warning:
This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7.1 and later releases, but use at your own risk!
Technical explanation and details:
http://undocumentedmatlab.com/blog/uiinspect
Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)
Yair Altman (2021). UIINSPECT - display methods, properties & callbacks of an object (https://www.mathworks.com/matlabcentral/fileexchange/17935-uiinspect-display-methods-properties-callbacks-of-an-object), MATLAB Central File Exchange. Retrieved .
Inspired by: findjobj - find java handles of Matlab graphic objects
Inspired: findjobj - find java handles of Matlab graphic objects, checkClass - inspect a Java/Matlab/COM class object/name, getundoc - get undocumented object properties, convert objects to string, propertiesGUI - display properties in an editable context-aware table, Programmatically scroll Variables Editor, Figure from text file (supports HTML tags), checkVersion - Check for a newer file version on the File Exchange, scatool
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
I get the following error in R2018a,
h = guide;
h.uiispect
uiinspect: Error using inputname
Argument number is not valid.
Error in uiinspect (line 140)
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);
Useful for working on large, complex GUIs that someone else wrote!
I am sure you know this one already, but:
Warning: NARGCHK will be removed in a future release. Use NARGINCHK or NARGOUTCHK instead.
> In uiinspect (line 114)
Another small obscure issue to report. I was trying to inspect private methods for matlab.io.MatFile objects (HDF5 files) on a large h5 file and quickly overflowed my memory as uiinspect enumerated my arrays as property value pairs.
@Mark - I just uploaded a fix that should solve this problem for R2014a and earlier Matlab releases (it was already ok for R2014b and later).
@Mark - I just uploaded a fix that should solve this problem for R2014a and earlier Matlab releases (it was already ok for R2014b and later).
Hi,
I'm having the same problem that David had on 23 Oct 2014:
>> uiinspect(0)
uiinspect: Error using setappdata
Invalid object handle
Error in uiinspect>getHandleTree (line 1384)
setappdata(tree_h, 'userdata',userdata);
Error in uiinspect>getMethodsPane (line 1315)
paneContents = getHandleTree(obj, hFig);
Error in uiinspect>displayObj (line 361)
[methodsPane, hgFlag] = getMethodsPane(objMethods, obj, hFig);
Error in uiinspect (line 139)
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren,
inputname(1), fig);
Version info:
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.3.0.532 (R2014a)
MATLAB License Number: 981453
Operating System: Mac OS X Version: 10.9.4 Build: 13E28
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 8.3 (R2014a)
>>
@Daniel - please download the latest version of UIINSPECT and retry. I think that it should solve your problem. If it doesn't then let me know.
Hi Yair,
This is a really great tool, but I am having trouble getting it to run in 2014b for Mac. The issue seems to be a property of uitree you are accessing that has disappeared in this version. Here is the error:
SNIP
>> uiinspect(0)
uiinspect: Error using javahandle.com.mathworks.hg.peer.UITreePeer/set
The name 'NodeExpandedCallback' is not an accessible property for an instance of class 'com.mathworks.hg.peer.UITreePeer'.
Error in uiinspect>getHandleTree (line 1384)
set(tree_hh, 'NodeExpandedCallback', {@nodeExpanded, tree_h});
Error in uiinspect>getMethodsPane (line 1311)
paneContents = getHandleTree(obj, hFig);
Error in uiinspect>displayObj (line 360)
[methodsPane, hgFlag] = getMethodsPane(objMethods, obj, hFig);
Error in uiinspect (line 138)
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);
/SNIP
And my version information
SNIP
ver
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.4.0.150421 (R2014b)
MATLAB License Number: 900355
Operating System: Mac OS X Version: 10.9.5 Build: 13F34
Java Version: Java 1.7.0_67-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
/SNIP
@David - this is fixed in the latest version that I have just uploaded. Enjoy!
Hi Yair,
Great tool...I've used it many times in the past with no problems. I tried running it today but got the error message,
uiinspect: Error using setappdata
Invalid object handle
Error in uiinspect>getHandleTree (line 1376)
setappdata(tree_h,
'userdata',userdata);
Error in uiinspect>getMethodsPane (line 1308)
paneContents = getHandleTree(obj,
hFig);
Error in uiinspect>displayObj (line 358)
[methodsPane, hgFlag] =
getMethodsPane(objMethods, obj, hFig);
Error in uiinspect (line 136)
fig = displayObj(obj, objMethods,
objProps, objCallbacks, objChildren,
inputname(1), fig);
My version info is
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.3.0.532 (R2014a)
MATLAB License Number: ******
Operating System: Microsoft Windows 7 Enterprise Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
Thanks so much,
David
Great tool. I couldn't live without it.
Amazing work, which complements the built-in Matlab editor, but can also be used in compiled Matlab applications (mcc). Many thanks.
@Jonathan - you can simply click the arrow on the top of the split-pane divider.
Or you can modify line #378:
hsplitPane.setResizeWeight(0.6);
to some other value (e.g., 0.1) to make a permanent change.
Yair,
Is there a command/feature to cause the split panes to collapse such that the inspectable object properties pane is the only one immediately visible?
Thanks in advance.
Jonathan
So far, I'm having just one problem. It keeps asking to update to most recent version (25-Jan-2013), even though it has already been updated. The actual file "modified" date is 22-Jan-2013.
I finally got around to downloading it after your latest post. Great work!
Yair,
I love your work, but the most recent version of this is crashing out on me:
uiinspect(0)
uiinspect: Dot name reference on non-scalar structure.
Error in uiinspect>getCbsPane (line 1080)
hModel = handle(callbacksTable.getModel, 'CallbackProperties');
Error in uiinspect>displayObj (line 323)
[callbacksPanel, cbTable] = getCbsPane(objCallbacks, false);
Error in uiinspect (line 128)
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);
Many thanks for your submissions, regardless.
Dan
@Johannes & @Henrik - the latest versions of uiinspect and findjobj that I uploaded a few days ago should have these issues fixed. They also have a few functional fixes/improvements, so it's worth downloading an update.
Yair,
thanks for all your work.
I tried the latest versions of uiinspect(9.12.2011) and findjobj (25.7.2012) together and ended up with the following error:
>> hFig = uiinspect(0);
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getHandleTree at 1093
In uiinspect>getMethodsPane at 1030
In uiinspect>displayObj at 308
In uiinspect at 114
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getHandleTree at 1094
In uiinspect>getMethodsPane at 1030
In uiinspect>displayObj at 308
In uiinspect at 114
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getHandleTree at 1101
In uiinspect>getMethodsPane at 1030
In uiinspect>displayObj at 308
In uiinspect at 114
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getHandleTree at 1102
In uiinspect>getMethodsPane at 1030
In uiinspect>displayObj at 308
In uiinspect at 114
Warning: Possible deprecated use of set on a Java callback.
> In uiinspect>getCbsPane at 902
In uiinspect>displayObj at 309
In uiinspect at 114
??? uiinspect: Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: No such child: 0
at java.awt.Container.getComponent(Unknown Source)
Error in ==> uiinspect>getPropsPane at 449
inspectorTable = inspectorTable.getComponent(0);
Error in ==> uiinspect>displayObj at 310
[propsPane, inspectorTable] = getPropsPane(objProps);
Error in ==> uiinspect at 114
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren,
inputname(1), fig);
My version:
-------------------------------------------------------------------------------------
MATLAB Version 7.11.0.584 (R2010b)
MATLAB License Number: XXXXXX
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
-------------------------------------------------------------------------------------
Any help is appreciated.
Regards,
Johannes
Absoluytely incredible !! superbe work.
I get following error when I try to use "uiinspect" in MATLAB R2011a. I have JUST downloaded the latest version on this page.
>> hFig = uiinspect(gcf);
Warning: Possible deprecated use of set on a Java object with an HG Property 'MousePressedCallback'.
> In uiinspect>getHandleTree at 1094
In uiinspect>getMethodsPane at 1023
In uiinspect>displayObj at 306
In uiinspect at 112
Warning: Possible deprecated use of set on a Java object with an HG Property 'MouseMovedCallback'.
> In uiinspect>getHandleTree at 1095
In uiinspect>getMethodsPane at 1023
In uiinspect>displayObj at 306
In uiinspect at 112
Warning: Possible deprecated use of set on a Java object with an HG Property 'UserData'.
> In uiinspect>getCbsPane at 895
In uiinspect>displayObj at 307
In uiinspect at 112
??? uiinspect: Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: No such child: 0
at java.awt.Container.getComponent(Unknown Source)
Error in ==> uiinspect>getPropsPane at 446
inspectorTable = inspectorTable.getComponent(0);
Error in ==> uiinspect>displayObj at 308
[propsPane, inspectorTable] = getPropsPane(objProps);
Error in ==> uiinspect at 112
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);
>>
>> ver
-------------------------------------------------------------------------------------
MATLAB Version 7.12.0.635 (R2011a)
MATLAB License Number: ******
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
-------------------------------------------------------------------------------------
MATLAB Version 7.12 (R2011a)
Neural Network Toolbox Version 7.0.1 (R2011a)
Statistics Toolbox Version 7.5 (R2011a)
>>
Cheers,
Henrik
@Deng - I am not seeing the error that you reported. Please ensure that you are using the latest version of uiinspect. If you are using the latest version, please specify your system configuration as reported by the Matlab ver command.
error:
hFig = uiinspect(0); % root (desktop)
??? uiinspect: Conversion to double from javahandle_withcallbacks.com.mathworks.hg.peer.UITreePeer is not possible.
Error in ==> uiinspect>getHandleTree at 1227
setappdata(tree_h, 'userdata',userdata);
Error in ==> uiinspect>getMethodsPane at 1162
paneContents = getHandleTree(obj);
Error in ==> uiinspect>displayObj at 318
[methodsPane, hgFlag] = getMethodsPane(objMethods, obj);
Error in ==> uiinspect at 124
fig = displayObj(obj, objMethods, objProps, objCallbacks, objChildren, inputname(1), fig);
Simply excellent. Thanks Yair
thanks Andrew - this will be fixed in the next update
To follow up my rating, I wanted to say that I have found this to be a very useful tool. However, I think I found a small bug: On line 773 where it is attempting to get property values to display the code currently reads:
if strcmpi(mp.SetAccess,'public')
For this to make sense, I believe it really should be:
if strcmpi(mp.GetAccess,'public')
For anyone interested, UIInspect now supports:
- Handle Graphics (GUI) objects
- Matlab class objects (e.g., memmapfile)
- Custom (user-defined) class objects
- Java objects
- COM (ActiveX or server) objects
what are the chances this could be extended to work with custom handle objects, i.e. classes that inherit from handle?
Thanks for this very useful and sophisticated tool! Works great even with Java objects
"Thank you for this excellent application" is what I meant to say.
I love this program! What a nice way to ease myself into COM objects! Thank you for this excellent applications.