How to display vector elements in a structure field?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Layla Bitar
am 18 Okt. 2020
Kommentiert: Layla Bitar
am 19 Okt. 2020
Hello,
I have a bigginer's question that might be simple. But I can't figure out how to display the vector that is saved into my structure. When I type my structure in the command window, I get the fields and their values. However, some of my fields contain a vector and only display by their size. The only way to display the values in the vector is if I type out.TotDef, however is there a way to have it display automatically?
Here is my command window:
out =
struct with fields:
UncMDef: [0 0.001125000000000 0.001800000000000 0.002700000000000]
UncLoad: [0 600000 600000 900000]
React0: 5.769230769230769e+05
React1: 3.230769230769231e+05
TotLoad: [1×4 double]
Stress: [1×4 double]
TotDef: [1×4 double]
I have a beginner's question that might be simple. But I can't figure out how to display the vector that is saved into my structure. When I type my structure in the command window, I get the fields and their values. However, some of my fields contain a vector and only display their size. The only way to display the values in the vector is if I type out.TotDef for example, however is there a way to have it display automatically? How come my top two structure fields show their elements in the vector?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 18 Okt. 2020
MATLAB does not give any control over the number of elements displayed by @struct/display
Some similar matlab routines choose the display width according to the width of the command window, but if I recall correctly the code was set up in a way that getting more than 4 elements required that the command window be more than roughly 2000 pixels wide.
Other routines are hard coded to display only the size if there is more than one row or more than 3 elements.
There is no preference settings for this purpose.
Some of the routines are written in a way that the widths can be hacked by abusing overloading functions. I would not recommend that approach.
You should probably write your own structure display routine.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!