TreeTable in Matlab 2025a
142 次查看(过去 30 天)
显示 更早的评论
Since javacomponents are deprecated as of MATLAB 2025a, has anyone found a way to generate treetables similar to what was possible with jide ?
We have been relying on those for a lot of GUI and see nothing in UITABLE/UITREE that would be similar. Necessary features are
- tree opening
- resizable columns
- cell renderer allowing push buttons and pull down menus
- column sorting is a bonus

4 个评论
dpb
2025-8-31,13:46
编辑:dpb
2025-8-31,17:47
The above link didn't quite work , maybe https://www.ag-grid.com/javascript-data-grid/getting-started/ is example component...
It would seem the short tem solution for all would be for Mathworks to reverse the decision to pull Swing until whatever is the longterm replacement does have at least equivalent functionality.
It's bound to be extremely frustrating given a 5-year history of the functionality need for them to then have gone ahead and made the unilateral decision to pull the existing functionality. One would hope TMW will listen to the support request and provide a workaround if not entirely reverse the course of the leviathan.
回答(1 个)
Samayochita
2025-9-2,4:19
编辑:Samayochita
2025-9-2,4:21
Hi Etienne,
I understand that you are trying to generate treetables in MATLAB. Unfortunately, there is no built-in treetable component available but here is a high-level view of how you could implement treetable by using “uitree” and “uitable” and synchronizing their events so that expanding or collapsing nodes dynamically updates the table rows.
1. Build the UI layout
- Use “uifigure” followed by “uigridlayout” with two columns. Column 1 will contain “uitree” for hierarchy. Column 2 will contain the “uitable” for data.
- This makes them look like one component aligned row by row.
2. Define the tree data: Represent the hierarchical data as a nested structure.
3. Handling expand/collapse logic:
- Attach “NodeExpandedFcn” and “NodeCollapsedFcn” callback to the “uitree”. Inside these callbacks, recompute which nodes are visible and refresh the “uitable” accordingly.
- This makes the table row count increase or decrease dynamically when tree nodes are toggled.
4. Flattening helper function
- Write a recursive function to convert hierarchical nodes into a flat array of rows.
- For every expanded node, add a row to the table.
Note:
- “uitable” in App Designer supports interactive column resizing by default.
- Drop-down menus in “uitable” are supported using the 'ColumnFormat' property.
- There is no direct way to put a push button into a “uitable”. You might be able to do it with Java, but the only component that “uitable” supports is checkbox.
Some links for your reference:
- uifigure: https://www.mathworks.com/help/matlab/ref/uifigure.html
- uigridlayout: https://www.mathworks.com/help/matlab/ref/uigridlayout.html
- uitree: https://www.mathworks.com/help/matlab/ref/uitree.html
- uitable: https://www.mathworks.com/help/matlab/ref/uitable.htmlhttps://www.mathworks.com/matlabcentral/answers/444826-how-can-i-make-a-push-button-in-a-uitable
- https://www.mathworks.com/matlabcentral/answers/452199-how-can-i-have-dropdown-in-every-cell-of-a-table-in-app-designer
- https://www.mathworks.com/help/matlab/ref/matlab.ui.container.tree.html
- https://www.mathworks.com/help/matlab/ref/matlab.ui.control.table.html
You could also refer to the following file exchange: https://www.mathworks.com/matlabcentral/fileexchange/42946-treetable-create-a-sortable-table-control-with-collapsible-row-groups
Hope this was helpful.
6 个评论
dpb
2025-9-4,18:43
It's got to be tough to support a major app given the dynamic nature of MATLAB and particularly with the reinvention of things and the shift in implementation toolsets. While some at least is understandable owing to external changes, it can't be easy when new doesn't match old and particularly when there is actual loss of functionality rather than just a recoding of a different widget but that at least can do the same thing.
You have my sympathy for what little that's worth <vbg> and good luck in finding a way forward.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!