CELL2UITABLE | Display cell array in customizable uitable

version (4.57 KB) by Bob Spunt
Display cell array in properly sized uitable with menu option to print to CSV


Updated 4 Jul 2017

From GitHub

View License on GitHub

This is simple tool for presenting a cell array in a properly sized uitable. Option to customize column names and table title. Moreover, table figure menu will have the option to print the cell array to a CSV file.
USAGE: h = cell2uitable(data, varargin)
h: struct containing
.fig: handle to parent of uitable
.tab: handle to uitable
.menu: handle to uimenu (if present)

data: cell array to present

NOTE: These should be entered as ['name', value] argument pairs, which are parsed based on identifying case-insensitive matches to one of the argument names listed below. Partial matches are OK as long as only one match exists in the set of optional arguments. (For instance, 'fonts' matches only 'fontsize' below and is thus valid, whereas 'font' matches both 'fontsize' and 'fontname' and wll throw an error.) Each argument has a default value specified at the beginning of the function. To view the current defaults in the command window, run CELL2UITABLE with no arguments.

parent: handle to parent (creates new fig if empty)
colnames: cell array of column names
rownames: cell array of row names
rowstriping: 'on' | 'off'
fontsize: font size for table contents
fontname: font name for table contents
rearrangeablecols: 'on' | 'off'
oversizecolfactor: factor to mulitply auto-computed column width (useful for making all cell contents visible)
addsaveuimenu: logical flag to include/exclude uimenu for saving
editable: used to set 'ColumnEditable' property of uitable
backgroundcolor: uitable background color
foregroundcolor: uitable foreground color
emptypadsize: if >0, pads with that # empty editable rows/cols

mydata = num2cell(randn(20, 3));
mycolnames = {'Col 1' 'Col 2' 'Col 3'};
myrownames = repmat({'Row 1'}, size(mydata, 1), 1);
h = cell2uitable(mydata, 'coln', mycolnames, 'rown', myrownames);

Cite As

Bob Spunt (2022). CELL2UITABLE | Display cell array in customizable uitable (https://github.com/spunt/cell2uitable), GitHub. Retrieved .

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

Community Treasure Hunt

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

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.