Message Boards Message Boards

0
|
3440 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:
GROUPS:

Combining Arrays (two 2x2 into one 4x4)

Hi,

How can I transform:
a = {{4, 1}, {1, 3}};
b = {{-1, -2}, {1, -2}};
into
c = {{4, 1, -1, -2}, {4, 1, 1, -2}, {1, 3, -1, -2}, {1, 3, 1, -2}};

I.M.
POSTED BY: Ivan Morozov
2 Replies
Posted 12 years ago
In[7]:= Flatten[Outer[Join, a, b, 1], 1]

Out[7]= {{4, 1, -1, -2}, {4, 1, 1, -2}, {1, 3, -1, -2}, {1, 3, 1, -2}}
POSTED BY: David Keith
Great, thank you David!
POSTED BY: Ivan Morozov
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