merging two table cells?

11 ビュー (過去 30 日間)
ALEXANDROS
ALEXANDROS 2024 年 9 月 25 日
コメント済み: dpb 2024 年 9 月 28 日
I was wondering if there is a way to merge two cells of a uitable. I have a uitable with 6 pairs of variables, thickness and cost, i want to add one more row on top of the headers of these columns so that i have for example Category1(Thickness1, Cost1), Category2(Thickness2, Cost2) etc.
Thank you in advance!

回答 (2 件)

dpb
dpb 2024 年 9 月 25 日
Not possible; a uitable isn't an Excel spreadsheet. To mimic the effect you could perhaps add another table with only three columns above the one although I've never tried such...it might be simpler to just use text boxes.
  1 件のコメント
ALEXANDROS
ALEXANDROS 2024 年 9 月 28 日
Okay, thank you very much i will see what i can do!

サインインしてコメントする。


Voss
Voss 2024 年 9 月 25 日
Not possible to merge cells, but you can make multi-line column headers in a uitable that's in a uifigure, which may be good enough. Run the following examples and see how they look (can't create uifigures here):
N = 6;
f = uifigure();
t = uitable(f,'ColumnName',compose("Category"+(1:N)+"\n"+["Thickness";"Cost"]+(1:N)))
f = uifigure();
t = uitable(f,'ColumnName',compose("Category"+(1:N)+"\n"+["Thickness";"Cost"]))
  2 件のコメント
ALEXANDROS
ALEXANDROS 2024 年 9 月 28 日
This is similar to what i have done, if you exclude the ("Category" + (1:N)) part. I might leave it as is, i export the table into an excel spreadsheet anyways and i believe the titles are pretty straight forward especially if i add some guide texts somewhere to explain a few things to the user. So i can work with that i guess. Thank very much for your help!
dpb
dpb 2024 年 9 月 28 日
Iffen it's the end result in Excel that is the more important result, then you can use ActiveX and dress up the Excel sheet to your heart's content; you aren't limited to only what the writetable and friends routines can do.

サインインしてコメントする。

カテゴリ

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

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by