UITABLE creates a two dimensional graphic uitable
This is an alternative to MATLAB 7's UITABLE. It will work with MATLAB 6.5 and also in no-JAVA mode.
This was developed based on the functions "tableGUI" by Joaquim Luis (2006-02-17) and "Editable Table in MATLAB" by Morris Maynard (2005-01-17) which are both available from the MATLAB Central File Exchange.
data = uitable(rand(3,2));
%Creates a 3x2 modal uitable in a new figure window.
hAxes = axes('units','pixels','position',[45 45 400 140]);
a = uitable(hAxes, cell(3,12));
%Creates an empty 3x12 modal uitable in the axes specified by hAxes
modal: 0 or 1 specifying modal state
nVisibleRows: int specifying number of visible rows
nVisibleCols: int specifying number of visible columns
colLabels: 0, 1, or cell array of strings for column labels
checkBoxes: 0, 1, or vector of int for check boxes
rowNumbers: 0 or 1 for row numbers
disabledColumns:  or vector of int for preventing column editing
colWidth: 1 or vector of int for indicating relative column widths
highlightCell: 0 or 1 -- highlight selected cell
highlightRow: 0 or 1 -- highlight row of selected cell
highlightCol: 0 or 1 -- highlight column of selected cell
fontsize: int for font size
precision: s for formatting data (see fprintf)
The main features of this UITABLE implementation are:
(1) Axes-defined table size. This makes it convenient for use with GUIDE and general GUI use.
(2) Modal/non-modal behavior. Can use within larger GUI or as stand-alone.
(3) Vertical and horizontal sliders. User controls how many cells to show.
(4) Row checkboxes. Optional specification for number of check boxes.
(5) Highlighting. Cells, rows, columns highlighting options exist.
(6) Column disabling. Prevent editing of specified data columns.
Its main disadvantages are:
(1) Large tables (> 400 cells) may require substantial refresh duration when scrolling.
(2) Table implemented as a set of uicontrols. User must be cautious with commands like findobj('type','uicontrol').
(3) If highlighting is enabled, WINDOWS users must click on a cell twice to edit its contents. Single clicking suffices in UNIX. Refer to ?MATLAB functions: uicontrol? in MATLAB help.
Todd Pataky (2020). uitable (https://www.mathworks.com/matlabcentral/fileexchange/11201-uitable), MATLAB Central File Exchange. Retrieved .
It's almost exactly what I need, but with some unfortunate flaws. I'd be willing to raise my rating if the table and its window were made resizable. Also, it is strange that an error message
Error using guitable>callback_close (line 1347)
Use the "OK" or "cancel" button to exit modal mode.
is given when trying to close the table window. Seems to me that the close button should simply be interpreted as "cancel".
Causes compiled standalone slowdown (6.5.2 R13SP2). Has anybody fixed this?
works like a charm! best improvements over matlab uitable - remove row numbers, customize column widths
I will add one comment just to thank the autor for sharing his work.
It works great if units of graphics objets are in pixels, but it fails if its value is 'characters' which moreover is the default value used in GUIDE guis. So I suggest to add one line to ensure units are set to pixels when graphic calculatins are to be made. For example, I will add a line 630 of the type: set(tb.hAxes,'Units','pixels')
I have to research a little more to find our if its need to add something similar everywhere else. But, as I said, thanks to the author for his work
Inspired by: Editable Table in MATLAB