1
$\begingroup$

I know someone may have asked similar questions but the solution doesn't work to me.

My code is like this:

a = ComponentMeasurements[
  MorphologicalComponents[rb], {"Centroid" , "Area"}, #2 > 60 &] 

My output is

{1 -> {{134.861, 140.779}, 65.5}, 2 -> {{168.362, 140.052}, 62.5}}

How can I make the output be {{134.861,140.799},{168.362,140.052}}?

$\endgroup$
2
  • $\begingroup$ Please format your code properly. Have a look at the FAQ for how it is done. I'll do it for you this time... $\endgroup$
    – Ajasja
    Nov 5, 2013 at 16:50
  • $\begingroup$ @Ajasja Thank you very much!:) $\endgroup$
    – KathyLL
    Nov 5, 2013 at 19:25

2 Answers 2

4
$\begingroup$

You can use Part, or the short hand notation [[]].

out = {1 -> {{134.861, 140.779}, 65.5}, 2 -> {{168.362, 140.052}, 62.5}}
out[[All, 2, 1]]

produces the desired result.

$\endgroup$
1
$\begingroup$

They are rules:

out = {1 -> {{134.861, 140.779}, 65.5}, 2 -> {{168.362, 140.052}, 62.5}}; 
First /@ (Range@2 /. out)
(*
{{134.861, 140.779}, {168.362, 140.052}}
*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.