MATLAB: How to get field value from a struct as a variable in order to use in a code

structvariable

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

Best Answer

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.