uitable and use within a figure created with the function figure

84 visualizaciones (últimos 30 días)
Jeffrey Beckstead
Jeffrey Beckstead el 11 de En. de 2021
Comentada: Walter Roberson el 15 de Dic. de 2021
I have been attempting to use the function uitable to print a table on a figure generated with the "figure" command.
The table data is within the variable tableData and the function call is
figID = figure;
uitable( figID_Comb, 'Data', tableData, 'Position', [300, 400, 200, 300]);
When I use this call, I get the message
Error using uitable
Functionality not supported with figures created with the figure function. For more information, see Graphics
Support in App Designer.
The help information on the uitable functions states: uit = uitable creates a table user interface component in the current figure and returns the Table UI component object. If there is no figure available, MATLAB® calls the figure function to create one.
The error message and the help information are contradictory - I believe.

Respuestas (2)

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi el 27 de En. de 2021
Hi,
As the error message suggests, 'uitable' cannot be used with figures created using 'figure' function.
I have brought the issue related to the help function on uitable to the notice of our developers. They will investigate the matter further.
  1 comentario
Frank
Frank el 14 de Dic. de 2021
I concur with Jeffrey. The documentation and implementation are contradictory and even the examples have been difficult to emulate. As of right now, uitable use in normal work (i.e. not constructing an app but just generating figures for publication and such) is not an option for me and I simply do not try to use it anymore. It would be nice if it was easier to use.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 14 de Dic. de 2021
There is no contradiction. The bit about creating a figure if none is available only applies if no parent is specified. You are supplying a parent.
After that you need to look at the details for the Data option, which says,
You are not using a uifigure as the parent.
If there is a fault in the documentation it would be that in the case
uit = uitable(Name,Value) specifies property values of the table UI component using one or more name-value pair arguments.
that it does not explicitly repeat the bit about looking for a parent... in the syntax summary list.
  2 comentarios
Frank
Frank el 15 de Dic. de 2021
OK. The end result is that with the current documentation/feature set, I just don't use it. But I am just focusing on presenting my specialty area, physics, not programming. I have been using matlab since before it was matlab, just gestating in eisspack, linpack, or minpack. From this user's perspective, it is easier to put tables elsewhere in my work products.
Walter Roberson
Walter Roberson el 15 de Dic. de 2021
uitable() for traditional figures accepts a cell array. You can use table2cell() to convert a table object to a cell array. You would not get features like the ability to sort by clicking on table headers, but that should not matter for publication purposes.
Custom color of cells inside uitable() for uifigure() is a much nicer interface than what is available with cell arrays in uitable() for traditional figures, and that does make a difference for publication.

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps 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