struct2table display 1 x l arrays compactly

I have a struct with fields containing all kinds of classes (strings, structs, doubles). I want to convert it to a table using struct2table however the fields that contain 1x100 doubles now show as 100 subcells instead of one compact cell.
what I got:
what i want (but as a table rather than struct)
I know this is pretty much only visual but its still annoying. Is there a way to change the display of these fields?

1 件のコメント

Torsten
Torsten 約14時間 前
Is there something you do differently ?
S.a = rand(1,100);
B = struct2table(S)
B = table
a ____________ 1×100 double
B{1,:}
ans = 1×100
0.0035 0.7209 0.3477 0.1833 0.0275 0.7440 0.4212 0.7092 0.0500 0.0125 0.2705 0.1719 0.9740 0.9355 0.5429 0.2230 0.0396 0.6804 0.6219 0.9251 0.3874 0.0538 0.5973 0.0496 0.1262 0.6682 0.0194 0.8474 0.4422 0.3196
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

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

回答 (1 件)

Star Strider
Star Strider 約14時間 前
編集済み: Star Strider 約13時間 前

0 投票

It apparently exists in your structure as a row vector. You will need to convert it to a column vector by transposing it, first.
Try something like this --
S.power_mech = rand(1,10)
S = struct with fields:
power_mech: [0.3775 0.7335 0.3994 0.9418 0.8657 0.5449 0.8141 0.6161 0.4464 0.7983]
T1 = struct2table(S)
T1 = table
power_mech __________________________________________________________________________________________________________ 0.37749 0.73353 0.39942 0.94178 0.86565 0.5449 0.81407 0.61608 0.44635 0.79826
S.power_mech = S.power_mech(:) % Transpose (Simple Transpose)
S = struct with fields:
power_mech: [10×1 double]
T2 = struct2table(S)
T2 = 10×1 table
power_mech __________ 0.37749 0.73353 0.39942 0.94178 0.86565 0.5449 0.81407 0.61608 0.44635 0.79826
.
EDIT -- (9 Mar 2026 at 15:35)
Format tweak.
.

カテゴリ

ヘルプ センター および File ExchangeStructures についてさらに検索

タグ

質問済み:

2026 年 3 月 9 日 14:48

編集済み:

2026 年 3 月 9 日 15:36

Community Treasure Hunt

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

Start Hunting!

Translated by