I have a struct with many fields and only a few rows. It is inconvenient for me to examine the data in the struct because I keep having to use the horizontal scroll bar. Is there a way for me to display the struct vertically? It would be almost like transposing the struct.

 채택된 답변

MathWorks Support Team
MathWorks Support Team 2021년 1월 22일

0 개 추천

There is currently no single function or Name-Value pair that can accomplish this task as of MATLAB R2020b.
However, there is a workaround available. If you would like to display the information in struct 'struct_a' vertically, you could use the following code to display the same information vertically, but in a cell array format instead:
>> table_a=struct2table(struct_a);
>> cell_a=table2cell(table_a);
>> cell_a=[table_a.Properties.VariableNames;cell_a];
>> vertical_cell_a=cell_a';

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

제품

릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by