How do I center numbers in a UI Table?

65 Ansichten (letzte 30 Tage)
Brad
Brad am 22 Jun. 2016
Bearbeitet: Walter Roberson am 28 Jan. 2018
I'm looking at using a UI Table to store numbers up to 5 characters in length. But I'm having problems getting the actual numbers centered within the tables columns. I created a small test case consisteing of the following code;
clear all;
close all;
clc;
data = {'123'; '1234'; '12345'};
f = figure('Position',[200 200 400 150]);
cnames = 'Part Numbers';
rnames = {'First','Second','Third'};
Table = uitable('Parent',f,'Data',data,'ColumnName',cnames,...
'RowName',rnames,'Position',[20 20 360 100],...
'fontname','courier');
In reviewing the documentation for UI Table, it appears there is no way to control the way the characters are placed in the table. They are either left or right justified based on them being characters or numbers.
Is there a way to possibly center the numbers outside of UITable?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 23 Jun. 2016
Bearbeitet: Walter Roberson am 28 Jan. 2018

Weitere Antworten (0)

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by