From: Zach on
I've got a few questions using the undocumented uitree in Matlab.

I've tried the following simple code in R2009a:
window = figure('Units', 'normalized', 'Name', 'Test');
tree_root = uitreenode('root', 'Root', [], false);
tree = uitree('v0','Root',tree_root);
set(tree, 'Units', 'normalized', 'Position', [0 0 1.0 1.0]);

This brings up a blank figure with no uitree and no errors.

If I put in the following without normalized units:
window = figure('Name', 'Test');
tree_root = uitreenode('root', 'Root', [], false);
tree = uitree('v0','Root',tree_root);

I get the tree, but then resizing the figure doesn't resize the tree like I'd want it to.


In addition, I'd like to know if there was a way to insert uicontrols like uitree and the like into custom guis made with GUIDE. Any help would be appreciated.

Thanks.
From: Yair Altman on
"Zach" <noreply(a)noreply.com> wrote in message <hlk230$t36$1(a)fred.mathworks.com>...
> I've got a few questions using the undocumented uitree in Matlab.
>
> I've tried the following simple code in R2009a:
> window = figure('Units', 'normalized', 'Name', 'Test');
> tree_root = uitreenode('root', 'Root', [], false);
> tree = uitree('v0','Root',tree_root);
> set(tree, 'Units', 'normalized', 'Position', [0 0 1.0 1.0]);
>
> This brings up a blank figure with no uitree and no errors.
>
> If I put in the following without normalized units:
> window = figure('Name', 'Test');
> tree_root = uitreenode('root', 'Root', [], false);
> tree = uitree('v0','Root',tree_root);
>
> I get the tree, but then resizing the figure doesn't resize the tree like I'd want it to.


The first alternative works on a R2008a system. Try to insert a drawnow and/or pause(0.02) immediately after your tree() command, to ensure the tree creation has completed - maybe it's an EDT-timing issue. For the second alternative, you can always specify normalized units AFTER you have created the figure and tree.


> In addition, I'd like to know if there was a way to insert uicontrols like uitree and the like into custom guis made with GUIDE. Any help would be appreciated.

Sure - I do this all the time. Simply add the relevant commands (uicontrol, javacomponent etc.) into the *_OutputFcn function of your GUIDE-created m-file (if your GUI is called ABC, then add the commands to the ABC_OutputFcn() function within the ABC.m file).

Yair Altman
http://UndocumentedMatlab.com