![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1687141/image.png)
Missing spaces in uitable column name
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
When multiple length spaces are included in the specification for the ColumnName property, they end up as single spaces which is very irritating. Replacing the cell array with a string array makes no difference. Is there any solution?
fig = uifigure;
tbl = uitable(fig, 'data', rand(4,3));
tbl.ColumnName = {'a1 1', 'a2 2', 'a3 3'};
0 Kommentare
Antworten (1)
Jaswanth
am 6 Mai 2024
Hi Gordon,
When you specify column names for a uitable in MATLAB and include multiple spaces in the names, MATLAB's default behaviour is to condense multiple spaces into a single space. As a workaround you can use significant whitespace character which is char(160) for Nonbreaking space.
Kindly refer to the code snippet below, where Nonbreaking space has been utilized.
fig = uifigure;
tbl = uitable(fig, 'data', rand(4,3));
% Define column names with non-breaking spaces i.e., char(160)
k = char(160);
tbl.ColumnName = {['a1' k k k '1'], ['a2' k k k k k '2'], ['a3' k k k k k k k k k k '3']};
Please refer to the following image which is output of the code provided above.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1687141/image.png)
Please go through the following MathWorks documentations to learn more about significant whitespace characters: https://www.mathworks.com/help/matlab/ref/strtrim.html?searchHighlight=char%28160%29&s_tid=srchtitle_support_results_4_char%2528160%2529#:~:text=Significant%20Whitespace%20Character
I hope the information provided above is helpful in accomplishing your task.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!