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 件のコメント
Is there something you do differently ?
S.a = rand(1,100);
B = struct2table(S)
B{1,:}
回答 (1 件)
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)
T1 = struct2table(S)
S.power_mech = S.power_mech(:) % Transpose (Simple Transpose)
T2 = struct2table(S)
.
EDIT -- (9 Mar 2026 at 15:35)
Format tweak.
.
カテゴリ
ヘルプ センター および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!