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$
  • $\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 '13 at 16:50
  • $\begingroup$ @Ajasja Thank you very much!:) $\endgroup$ – KathyLL Nov 5 '13 at 19:25
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, privacy policy and cookie policy

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