4
$\begingroup$

I would like to do the following:

startData = {{3.9, 5.2}, {5.5, 6.7}, {8.8, 5.3}, {3.9, 3.6}, {4.3, 3.8}};
endData = {{3.0, 6}, {5.3, 7}, {8.5, 6}, {4, 3.6}, {4.2, 4}};
MapThread[Arrow, {startData, endData}]

The problem is that Arrow requires the start and end point be bracketed, e.g.,

Arrow[{{3.9, 5.2}, {3., 6}}]

How can I add the extra brackets?

$\endgroup$
3
$\begingroup$

Use Arrow[{##}]& as the function in MapThread. See Function for more.

$\endgroup$
1
  • $\begingroup$ OK, great this works! I'll have to look into this, not fully sure about the syntax. $\endgroup$ Oct 24 '14 at 16:27
2
$\begingroup$

You just have to use slightly customized variant of Arrow.

startData = {{3.9, 5.2}, {5.5, 6.7}, {8.8, 5.3}, {3.9, 3.6}, {4.3, 3.8}}
endData = {{3.0, 6}, {5.3, 7}, {8.5, 6}, {4, 3.6}, {4.2, 4}};
MapThread[Arrow[{#1, #2}] &, {startData, endData}]
{Arrow[{{3.9, 5.2}, {3., 6}}], Arrow[{{5.5, 6.7}, {5.3, 7}}], 
 Arrow[{{8.8, 5.3}, {8.5, 6}}], Arrow[{{3.9, 3.6}, {4, 3.6}}], 
 Arrow[{{4.3, 3.8}, {4.2, 4}}]}
$\endgroup$
1
  • $\begingroup$ Thanks! I was looking for numbering the slots, know I hope I'll remember how to do it. $\endgroup$ Oct 24 '14 at 16:28

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.