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!