two row column name in appdesigner uitable

22 visualizaciones (últimos 30 días)
Roman
Roman el 15 de Mzo. de 2018
Comentada: Subhadeep Koley el 8 de Mayo de 2020
for a uitable the following does work: t = uitable('ColumnName',{'Name'; 'Telephone|Number'},'Data',{'Bob','555-1212'}) and I get column(2) name number written in 2 lines (Telephone and Number) doing the same thing in appdesigner: the column name is not split into two rows but stays as 'Telephone|Number' Is this to be expected or is there something more to consider?
  1 comentario
Subhadeep Koley
Subhadeep Koley el 8 de Mayo de 2020
One workaround:
Paste the following code in the startupFcn callback of your app to create a table with multi-line column header. Here, sprintf(__) with \n escape sequence is used to create multi-line column header.
% Create the UITable component
UITable = uitable(app.UIFigure);
% Specify row and column name
UITable.ColumnName = {sprintf('First\nEntry'); sprintf('Second\nEntry'); sprintf('Third\nEntry')};
UITable.RowName = {};
% Populate the table with some random data
UITable.Data = rand(3);
% Set the table position
UITable.Position = [148 224 302 108];

Iniciar sesión para comentar.

Respuesta aceptada

Vineeta Chaturvedi
Vineeta Chaturvedi el 28 de Jun. de 2018
Hi Roman,
I am able to reproduce the issue you mentioned.
It is because when you create a table directly without specifying any parent then default parent is figure and the uitable is created for which column name property supports "|" to get the multi-line column name.
Here is the documentation you can refer for details -
When you create a table in app designer. It gets created in uifigure parent and column names are restricted to one line of text.
Here is the documentation you can refer for details -
Thanks,
Vineeta

Más respuestas (0)

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by