Borrar filtros
Borrar filtros

Centering data in uitable without using uifigure?

2 visualizaciones (últimos 30 días)
Jordan Luke
Jordan Luke el 6 de Sept. de 2023
Respondida: Sachin el 11 de Sept. de 2023
I need to center the data in my table without using the uifigure function as I am placing the uitable and a plot on the same figure using subplots and then later outputting to a pdf.
Any help appreciated!
Data = cellstr(string([xPosRound yPosRound jbChngRound jbDistBtwnRound]));
format default
m = 6;
figure
hAx=subplot(m,m,[7 8 9 13 14 15 19 20 21 25 25 27 31 32 33]);
hUI=uitable('Data',Data, ...
'ColumnName',["X" "Y" "Chainage" "Distance"],...
'RowName',row_array', ...
'Units', ...
'Normalized', ...
'Position',hAx.Position); axis off
hAy=subplot(m,m,[10 11 12 16 17 18 22 23 24 28 29 30 34 35 36]);
plot(xPos,yPos,'bo',x,y,'r'); axis padded equal
hAz = subplot(m,m,[3 4]);
imshow('mwp.jpg')
set(gcf, 'Position',[100 500 1040 800])

Respuestas (1)

Sachin
Sachin el 11 de Sept. de 2023
Hi Jordan,
I understand that you want to centrethe data in the table without using the ‘uifigure’ function.
There are some limitations when using 'figure'. I suggest you to use 'uifigure' to work with your workflow. A possible workaround that might be helpful to you when using the ‘uifigure’:
  1. Use the ‘uifigure’ and ‘uitable’ to add the table.
  2. After creating the table use ‘uistyle’ to center the data entries. Refer the following MATLAB Answer : https://in.mathworks.com/matlabcentral/answers/488135-how-to-change-horizontal-alignment-left-right-center-of-entries-in-a-uitable
  3. To add the ‘subplot’ in the ‘uifigure’, refer to the following MATLAB Answer - https://in.mathworks.com/matlabcentral/answers/1852898-how-to-use-subplot-in-a-uifigure
  4. If you want to save the figure, refer this MATLAB Answer - https://in.mathworks.com/matlabcentral/answers/406897-how-to-save-uitable-uifigure-into-pdf-file
I hope these suggestions helps in resolving the issues you are facing.
Thanks
Sachin

Categorías

Más información sobre Develop uifigure-Based Apps en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by