这一定非常容易,但我无法弄清楚。我有这两个表:
examplea =
Table[{a, i, attrib1, attrib2, RandomInteger[10000]}, {i, 1, 3}] //
TableForm
a 1 attrib1 attrib2 3061
a 2 attrib1 attrib2 8818
a 3 attrib1 attrib2 3762
exampleb =
Table[{b, i, attrib1, attrib2, RandomInteger[10000]}, {i, 21, 23}] //
TableForm
b 21 attrib1 attrib2 1480
b 22 attrib1 attrib2 857
b 23 attrib1 attrib2 347
我现在需要制作一个如下所示的列表:
a 1 attrib1 attrib2 3061
a 2 attrib1 attrib2 8818
a 3 attrib1 attrib2 3762
b 21 attrib1 attrib2 1480
b 22 attrib1 attrib2 857
b 23 attrib1 attrib2 347
答案 0 :(得分:3)
您的代码的问题在于您将表格设置为表格中已有的变量,这使得它们更难以使用。
您可以设置非表格表格,然后然后显示在表格中...
Print@TableForm[examplea = Table[{a, i, attrib1, attrib2,
RandomInteger[10000]}, {i, 1, 3}]];
Print@TableForm[exampleb = Table[{b, i, attrib1, attrib2,
RandomInteger[10000]}, {i, 21, 23}]];
Join[examplea, exampleb] // TableForm
...或者您必须从表格中提取表格以加入它们: -
Print[examplea = Table[{a, i, attrib1, attrib2,
RandomInteger[10000]}, {i, 1, 3}] // TableForm];
Print[exampleb = Table[{b, i, attrib1, attrib2,
RandomInteger[10000]}, {i, 21, 23}] // TableForm];
Join[First@examplea, First@exampleb] // TableForm