How to get field value from a struct as a variable in order to use in a code?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hey all
I want to extract x and y from this struct, as a seperate variables in my workplace, in order to use them in my code.
struct with fields:
Geometry: 'Polygon'
BoundingBox: [2×2 double]
X: [1×125458 double]
Y: [1×125458 double]
please help me
thanks a lot
0 Commenti
Risposta accettata
Guillaume
il 17 Ott 2019
There's no need to. Creating separate variables is usually not a good idea. Wherever you were going to use X, use yourstruct.X. Makes no difference to the code.
0 Commenti
Più risposte (2)
James Tursa
il 17 Ott 2019
Depends on your downstream code whether this is really worth it, but simply e.g.
x = yourstruct.x;
y = yourstruct.y;
0 Commenti
Vedere anche
Categorie
Scopri di più su Structures in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!