How do I place a uitable in a subplot (MATLAB R2013a)?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 21 de Nov. de 2016
Respondida: MathWorks Support Team
el 21 de Nov. de 2016
I would like to place a uitable so that it fits exactly into one of the subplots in my figure. Is there a way to associate a uitable with a subplot?
Respuesta aceptada
MathWorks Support Team
el 21 de Nov. de 2016
There is no way to directly associate a uitable with a subplot, as uitable cannot be children of an axes. However, there is a simple workaround for this which involves saving the properties of the subplot.
The general idea is to create the subplot where you want the uitable to be located. Once the subplot is created, you can save the "Position" property of the subplot. This property contains both the location and the size of the axes. You can also save the units to ensure that the "Position" values are interpreted correctly.
Once these values are saved, you can delete the axes, and create a uitable using the same "Position" and "Unit" properties. This will ensure that the uitable has the same location and size as the subplot axes. For example, please try the following example code.
hf = figure;
ha = subplot(2,3,5);
pos = get(ha,'Position');
un = get(ha,'Units');
delete(ha)
ht = uitable('Units',un,'Position',pos)
This will create a uitable exactly where the subplot was first displayed.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Subplots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!