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.

 Réponse acceptée

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';

Plus de réponses (0)

Catégories

Produits

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by