Support Articles

Support Articles Graphics Labelling Rows and Columns of a FlexArray Table

Labelling Rows and Columns of a FlexArray Table

Download Code

The FlexArray ActiveX control allows a neat way of creating tables in a MATLAB GUI. Labelling the rows and columns of this object using the Property Inspector from GUIDE is not possible. This article shows how the rows and columns can be labelled from m-code. This code could be inserted into GUIDE generated GUI code, but for this example the GUI is created manually.

Contents

 

Creating a FlexArray Control

A FlexArray control is manually inserted into a figure below. It is also possible to insert the control using GUIDE.

h = figure;
figurePosition = get(h, 'position');
hActX = actxcontrol('VSFLEX.vsFlexArrayCtrl.1', ...
[0 0 figurePosition(3) figurePosition(4)], h);
set(hActX,'cols',9,'rows',25);

Labelling the FlexArray's Rows and Columns

We can set the row and column names of the FlexArray control by accessing the control's 'Row' and 'Cols' properties. The current cell is specified by the selected row and column coordinates. This procedure is shown below.

% Label the rows
set(hActX,'Col',0);
for
k=1:get(hActX, 'rows')-1
set(hActX,'Row',0);
set(hActX,'Row',k);
set(hActX,'Text',['Row ' num2str(k)]);
end;

% Label the columns
set(hActX,'row',0);
for
k = 1:get(hActX, 'cols')-1
set(hActX,'Col',k);
set(hActX,'Text',['Column ' num2str(k)]);
end;