How to implement Uistyle in an output table
7 ビュー (過去 30 日間)
古いコメントを表示
Hello, I'd like to implement Uistyle in my table, which is an output of several equations:
I'd like to apply uistyle to emphasize some parts like this :
My table-generating code:
FloodIntensity = table(hPipe, Aflow, Qchannel, 'VariableNames',{'h' 'A' 'Q [m3/s]'} )
I have read documentation, but they only provide examples for imported csv. data or some rand-generated ones.
Can anyone show me an example, how to build Uistyle around such table, as mine?
0 件のコメント
採用された回答
Simon Chan
2022 年 1 月 29 日
Actually the documentation describe a lot of examples and I just copy some of them as follows:
Create a uitable on uifigure:
fig = uifigure;
uit = uitable(fig,'Data',FloodIntensity);
(1) Add background color to column 1 & 3:
s1 = uistyle('BackgroundColor','cyan'); % Create the uistyle
addStyle(uit,s1,'column',[1 3]); % Add style on column 1 and 3 only
(2) Change the fontcolor and fontweight for 0.5<A<1
idx.fontcolor = 0.5<FloodIntensity.A & FloodIntensity.A<1; % Find the index
row = find(idx.fontcolor); % Row number
col = repelem(2,length(row))'; % Column number
s2 = uistyle('FontColor','blue','FontWeight','bold'); % Define the uistyle, color is blue and bold type
addStyle(uit,s2,'cell',[row col]); % Add style on each cell satisfy your condition
(3) Horizontal alignment for the entire table
s3 = uistyle('HorizontalAlignment','center');
addStyle(uit,s3);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!