フィルターのクリア

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

1 回表示 (過去 30 日間)
BN
BN 2019 年 10 月 17 日
回答済み: BN 2019 年 10 月 17 日
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

採用された回答

Guillaume
Guillaume 2019 年 10 月 17 日
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.

その他の回答 (2 件)

James Tursa
James Tursa 2019 年 10 月 17 日
Depends on your downstream code whether this is really worth it, but simply e.g.
x = yourstruct.x;
y = yourstruct.y;

BN
BN 2019 年 10 月 17 日
Thank both of you. vote for all

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by