How to add cost to a polygon?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
SUSHMA MB
am 6 Apr. 2015
Bearbeitet: SUSHMA MB
am 9 Apr. 2015
I have coordinates of some polygons and they are stored in a cell, now i want to add cost to those, how can i do that? For ex: the coordinates of the polygons are [12.45 36.05; 12.45 35.7; 12.9 35.65; 12.9 36; 12.7 36; 12.7 36.1; 12.45 36.05] and similarly the coordinates of the other polygons are stored in a single cell. Now i want to add 500 as the cost of the polygon, how can i add?
I have stored the coordinates in x and y in a cell, now how to store the cost?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 6 Apr. 2015
You could have an array of structures - one structure for each polygon that stores the x, y, and cost as fields. For example, to assign the kth structure of the kth polygon:
polygons(k).x = yourXArray; % for that particular polygon.
polygons(k).y = yourYArray; % for that particular polygon.
polygons(k).cost = yourCostValue; % for that particular polygon.
2 Kommentare
Image Analyst
am 6 Apr. 2015
To get the cost of the kth polygon, just refer to it
theCost = polygons(k).cost;
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Elementary Polygons 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!