uitree cannot expand subdirectories when trailing filesep is missing.

I know that uitree is unsupported, but I thought it would be good to let you guys know about this bug anyways.
I have found a workaround already, so this is not really a question but a source of information for others. If this is not rhe right place for such a thing, please move it where it belongs.
Problem:
uitree cannot expand subdirectories when trailing filesep is missing.
I am using matlab version 2014b
Example (on a mac):
Folder tree:
/Users/foo/
bar/
subbar1/
subbar2/
bas/
Matlab code to reproduce problem:
mtree=uitree('v0','root','/Users/foo');
node=mtree.Root.getChildAt(0);
mtree.expand(node);
node.getChildCount
ans = 0
The reason can be seen with
node.getValue
ans =
/Users/foobar/
Note that the slash between foo and bar is missing (the path has been f* up beyond all recognition ;-).
Workaround:
If I call uitree with a trailing slash in the path, everything works fine:
mtree=uitree('v0','root','/Users/foo/');
node=mtree.Root.getChildAt(0);
mtree.expand(node);
node.getChildCount
ans = 2
node.getValue
ans =
/Users/foo/bar/

답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

제품

질문:

2015년 3월 31일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by