フィルターのクリア

No multiline column name when using vertical slash | in UItable

2 ビュー (過去 30 日間)
Alejandro Alonso Canales
Alejandro Alonso Canales 2020 年 11 月 10 日
回答済み: Walter Roberson 2020 年 11 月 10 日
When creating a Uitable inside a figure according to the documentation if i use a vertical slash while naming the columns i can create a new line, but when i code it it only appears the vertical slash |
d = {'LogStart', 0.2, 'Log End', 800, 3000};
ColumnNames = {'BGGas top|Zone name', 'BGGas value|%',...
'BGGas base|zone name', 'BGGas top|zone depth',...
'BGGas base|zone depth'};
zones = {'LogStart', 'Neogene', 'Paleogene', 'Cretaceous', 'Jurassic',...
'Triassic', 'Permian', 'Carboniferous', 'Devonian', 'Silurian',...
'Ordivician', 'Cambrian'};
fig = uifigure('Name', 'Enter Background Gas Value',...
'CloseRequestFcn',@Parent_closefcn);
%-------Table------
uit = uitable(fig);
uit.Position(1:2) = [10,150];
uit.Position(3:4) = [fig.Position(3)-20, fig.Position(4)-220];
uit.ColumnSortable = false;
uit.RowName = 'numbered';
uit.ColumnName = ColumnNames;
uit.Data = d;
uit.ColumnFormat = {zones, 'numeric', 'char', 'numeric', 'numeric'};
uit.ColumnEditable = [true true false false false true];
When run the GUI looks like this:
I also tried using HTML as mentioned in the Undocumented MATLAB forum
'<html>BGGas top<br />Zone name</html>'
With no success. Any idea why this is happening? or any alternative method for a multiline?
Thank you

採用された回答

Walter Roberson
Walter Roberson 2020 年 11 月 10 日
For uifigure() such as you are using then
Using | for ColumnName is not documented there.
The documentation for | is over at https://www.mathworks.com/help/matlab/ref/matlab.ui.control.table-properties.html which is for traditional figures.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by