How to change horizontal alignment (left, right, center) of entries in a UITable

59 ビュー (過去 30 日間)
How do I center the data entries in my UITable?

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 10 月 22 日
編集済み: MathWorks Support Team 2021 年 10 月 26 日
In MATLAB R2019b, there is a new feature called a UI style: 
Style objects are used to create color, font, and alignment styles for cells in table UI components. You can add Style objects to a specific UI component by using the "addStyle" function:
For example, if I wanted to center all the data entries in my UI table, I would do the following:
>> A = [1;2;3]; B = {'a';'b';'c'};>> f = uifigure;>> t = uitable(f,'Data',table(A,B));>> s = uistyle('HorizontalAlignment','center');>> addStyle(t,s,'table','');
See the above documentation links for more examples.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by