3
$\begingroup$

Assume I have two lists: A[1,1]={1,2} and A[2,1]={3,4}.

When I create a table

Table[A[i,j],{i,1,2},{j,1,1}] 

I get

{{{1,2}},{{3,4}}}

How can I have a result {{1,2},{3,4}}? Of course, using Table or some other function.

$\endgroup$
2
$\begingroup$
Table[A[i, 1], {i, 1, 2}]

{{1, 2}, {3, 4}}

Alternatively,

A[#, 1] & /@ {1, 2}

{{1, 2}, {3, 4}}

Also

Flatten[Table[A[i, j], {i, 1, 2}, {j, 1, 1}], 1]

{{1, 2}, {3, 4}}

$\endgroup$
0
$\begingroup$

You could also use Tuples:

Tuples[A[{1,2}, {1}]]

{{1, 2}, {3, 4}}

$\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.