How can I display a struct vertically?

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.

 Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 22 de En. de 2021
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';

Más respuestas (0)

Categorías

Productos

Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by