Accessing/Extracting Two values From a Single Field
Show older comments
Hello Guys. I am having some problem in accessing the values stored in a field. I have also uploaded an image to make my question more convenient and understandable. I hope I'll get a quick response and a working answer which solve my problem.
Answers and highly appreciated,Thanks In Advance

2 Comments
Walter Roberson
on 26 May 2015
What is the data structure for the "field" ?
Ibraheem Salim
on 27 May 2015
Answers (1)
Walter Roberson
on 27 May 2015
x1 = Field1(1);
y1 = Field1(2);
x2 = Field2(1);
y2 = Field2(2);
But possibly your results are results from regionprops. If we assume that you had a call such as
Field = regionprops(YourImage, 'Centroid');
then
x1 = Field(1).Centroid(1);
y1 = Field(1).Centroid(2);
x2 = Field(2).Centroid(1);
y2 = Field(2).Centroid(2);
1 Comment
Ibraheem Salim
on 27 May 2015
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!