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 ExchangeStructures についてさらに検索

製品

リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by