File Exchange

image thumbnail

treeTable - create a sortable table control with collapsible row groups

version (66.8 KB) by Yair Altman
Create a sortable Java-based tree-table GUI control having collapsible/expandable data row groups


Updated 06 Aug 2013

View License

htable = treeTable (pnContainer, headers, data, 'PropName',PropValue, ...)

Input parameters:
pnContainer - optional handle to container uipanel or figure (default: gcf)
headers - optional cell array of column header strings
data - optional numeric or cell array of data values
'PropName',PropValue - optional list of property-value pairs: Container, Headers, Data, IconFilenames, ColumnTypes, ColumnEditable, Groupable, InteractiveGrouping

(see internal help section for details)

Output parameters:
htable - handle to Java tree-table object

Important features:
* Table is fully sortable (multiple columns via ctrl-click on header)
* Table can be flat or hierarchical (grouping)
* Interactive grouping (like in Outlook)
* Editable drop-down (selector) option
* Table columns are automatically resized to fit the available width
* Table columns are rearrangeable by dragging the headers right/left
* Table columns can be resized by dragging their divider gridlines (not just the header)
* User-defined icons for leaf rows and grouping rows (expanded/collapsed)
* Sample data update and row selection callbacks included; user can attach custom callbacks

This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7+, but use at your own risk!

Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)

Technical details of the implementation can be found at

Cite As

Yair Altman (2020). treeTable - create a sortable table control with collapsible row groups (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (12)

Thibault Juge

Eduardo Barbier

Hi Yair,
Amazing work
I've been fighting with data output. Is there a simple way to recover all (moddified) data in the same cell format as originally loaded?

Nikolai Kritschmann

Dear Yair, is there a way to get access to the data which is saved in the model?
I want to update the data in this table often and it would be easier having an table.Data function like in uitable.

Juan Garcia

Christopher Jackson

Is it possible for the tree table to be able to allow users to add data rows for any label?

Yair Altman

@Ramiro - this would probably require a dedicated Java cell-renderer for the table column.

Ramiro Massol

hi Yair, is it possible to customize each node of treetable? let's say, have different icons for specific nodes?
Is it possible to have different data types under one column of treetable?




Dear Yair, there has been a discussion about wanted features for uitree and uitable in the forum:
Your treeTable solves many of the problems mentioned there. I cannot imagine, why TMW hesitates to implement such powerful GUI tools by their own.


Wow! That's amazing. Very useful. Great job!


This is great! One thing I noticed: When I enter "-0" in the Numeric column, it is not changed to "0". Is this intended behaviour? Also, when I move the first column, the folder symbols and labels are separated.


Add this to the It Simply Works(TM) suite of tools.


Forgot a couple of important Java files in the previous uploads, sorry about that...

Added InteractiveGrouping option to enable interactive column grouping as in Microsoft Outlook

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Java-based data table