View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Multi Column Listbox

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

5.0
5.0 | 1 rating Rate this file 5 Downloads (last 30 days) File Size: 9.35 KB File ID: #42670 Version: 1.0
image thumbnail

Multi Column Listbox

by

Robert Cumming (view profile)

 

Multi column listbox, including filtering & colouring of columns & extraction of individual values

| Watch this File

File Information
Description

UIMULTICOLLISTBOX contains the following methods:

        case 'addCol' % ( h, 'addCol', colItems , ColIndex )
        case 'addRow' % ( h, 'addRow', rowItems , rowIndex )
        case 'addFilter' % ( h, 'addFilter', colIndex, filterValue )
        case 'applyUIFilter' % ( h, 'applyUIFilter', useRow1AsLabels )
        case 'changeItem' % ( h, 'changeItem, 'NewValue', rowIndex, colIndex )
        case 'changeRow' % ( h, 'changeRow', 'NewItems', rowIndex )
        case 'columnColour' % ( h, 'columnColor', colIndex, 'Colour' )
        case 'delCol' % ( h, 'delCol', colIndex )
        case 'delRow' % ( h, 'delRow', rowIndex )
        case 'filtersApplied' % ( h, 'filtersApplied )
        case 'nCols' % ( h, 'nCols' )
        case 'nRows' % ( h, 'nRows' )
        case 'removeUIFilter' % ( h, 'removeUIFilter' )
        case 'resetFilter' % ( h, 'resetFilter' )
        case 'selectionInNumbers' % ( h, 'seletionInNumbers', colIndex )
        case 'selectedStrCol' % ( h, 'selectedStrCol', colIndex )
        case 'selectedString' % ( h, 'selectedString' )
        case 'separator' % ( h, 'separator', 'newColSeparator' )
        case 'setRow1Header' % ( h, 'setRow1Header', OnOffFlag )
        case 'string' % ( h, 'string', cellArrayStrings )
        case 'value' % ( h, 'value', selectionValue )

Is built on the standard MATLAB UICONTROL LISTBOX - all normal SET and GET are available on the handle.

Example:
d = dir;
for i=1:length(d)
  str{i,1} = d(i).name;
  str{i,2} = d(i).date;
  str{i,3} = d(i).bytes;
  str{i,4} = d(i).isdir;
  [dummy,dummy,ext] = fileparts ( d(i).name );
  str{i,5} = strcmp ( ext, '.m' );
end
% create the uimulticollist
h=uimulticollist ( 'units', 'normalized', 'position', [0 0 1 1], 'string', str, 'columnColour', { 'RED' 'RED' 'BLUE' 'BLACK' 'GREEN' } );
%
% now add a header
header = { 'FileName' 'Date' 'Bytes' 'isDir' 'isMFile' };
uimulticollist ( h, 'addRow', header, 1 )
% add an extra column
nItems = uimulticollist ( h, 'nRows' );
uimulticollist ( h, 'addCol', [0:nItems-1], 1, 'GREEN' )
% change a unique item
uimulticollist ( h, 'changeItem', 'ORDER', 1, 1 )
% apply a filter to the 6th col (where items = 1 )
uimulticollist ( h, 'addFilter', 6, 1 )

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
24 Aug 2016 Robert Cumming

Robert Cumming (view profile)

@Piyush - to multi select you modify the standard listbox 'Max' property: i.e.

h=uimulticollist ( ...., 'Max', 2 );

The seleted indexes are a standard listbox property, i.e.

indexes = h.Value;

Comment only
23 Aug 2016 Piyush

Piyush (view profile)

Hello Robert,
I need to multiselect the rows using shift+click or drag+left click and then know the indices which were selected. IS it possible, please let me know about the same. Thanks in advance.

Comment only
24 Feb 2016 Michael Beilles

Powerful function, thx a lot !

minor fix (line 386)
if col < 0 || row > nCols => if col < 0 || col > nCols

Contact us