display values in a loop
Show older comments
i have this code to find all the centroids which objects have the specific area. however, I couldnt find a way to display the values and maybe pass the values to a variable(s). I really appreciate it if somebody could help me with some demos.
below is part of the code:
id = find([s.Area] > 1000 & [s.Area] < 100000 );
for ii = 1:length(id);
hold on, plot(s(id(ii)).Centroid(1),s(id(ii)).Centroid(2),'wp','MarkerSize',10,'MarkerFaceColor','r'), hold off
i want to do something like.. %disp(['Center location is (',num2str(s(id(ii)).Centroid(1),4),', ',num2str(s(id(ii)).Centroid(2),4),')'])
thanks in advance!
2 Comments
David Young
on 5 Dec 2011
What is the problem with the code you have? I tried your suggested call to disp and it seems to work fine.
Shi Wei Foo
on 5 Dec 2011
Accepted Answer
More Answers (0)
Categories
Find more on Entering Commands 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!