Message Boards Message Boards

0
|
8465 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to join two simple parts programs

I'm sure this question should be very simple but I really am just a beginner trying to learn.

I am developing a program in two parts. One of this, calculates the centroid of the circular image. The centroid information is necessary calculates the total intensity of pixels in this circular image defined by a radius r disk. The problem is that the output of the centroid calculation provides x and y as follows {{x, y}}. This prevents the insertion of one part on the other. I need a type exit {x, y} or simply x, y ............................................................................................................

I really appreciate for any suggestion let me move on. Thanks,

Antonio

Attachments:
2 Replies

Hi Antonio,

I downloaded your notebook, but I'm not entirely sure I understand the problem... Does one of these things help you? Also, please take a look at the Documentation for Part and Flatten for more examples.

test = {{1, 2}}
test[[1]]
(*returns {1,2} *)

test2 = {{1, 2}, {3, 4}}
Flatten[test2]
(*returns {1, 2, 3, 4} *)

test3 = {{{1, 2}}, {{3, 4}}}
Flatten[test3, 1]
test3[[All, 1]]
(*both return {{1, 2}, {3, 4}} *)
Flatten[test3]
(*returns {1, 2, 3, 4} *)
POSTED BY: Bianca Eifert

Yes, your suggestions worked very well. Thank you.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract