Thread Subject: displaying values

Subject: displaying values

From: Shi Wei Foo

Date: 5 Dec, 2011 13:38:08

Message: 1 of 3

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!

Subject: displaying values

From: Branko

Date: 6 Dec, 2011 10:54:08

Message: 2 of 3

"Shi Wei Foo" wrote in message <jbihg0$da9$1@newscl01ah.mathworks.com>...
> 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!

doc fprintf:

fprintf('Center location is %f, %f \n',s(id(ii)).Centroid(1), s(id(ii)).Centroid(2));


Branko

Subject: displaying values

From: Shi Wei Foo

Date: 6 Dec, 2011 14:38:08

Message: 3 of 3

"Branko " <brankobogunovic@gmail.com> wrote in message <jbks8g$a2g$1@newscl01ah.mathworks.com>...
> "Shi Wei Foo" wrote in message <jbihg0$da9$1@newscl01ah.mathworks.com>...
> > 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!
>
> doc fprintf:
>
> fprintf('Center location is %f, %f \n',s(id(ii)).Centroid(1), s(id(ii)).Centroid(2));
>
>
> Branko


thank you Branko!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fprintf Branko 6 Dec, 2011 05:59:10
image processing Shi Wei Foo 5 Dec, 2011 08:39:10
rssFeed for this Thread

Contact us at files@mathworks.com