2014-11-14 4 views
0

알아낼 수는 없지만 이것은 매우 쉽습니다. 나는이 두 개의 테이블이 있습니다두 테이블을 결합하는 방법

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 

답변

3

코드의 문제는 당신이 tableform에 이미 변수 테이블을 설정하는 것입니다 , 사용하기가 더 어색해진다.

당신은 비 tableform 테이블을 설정할 수 있습니다

다음 tableform에서 표시 ...

[email protected][examplea = Table[{a, i, attrib1, attrib2, 
     RandomInteger[10000]}, {i, 1, 3}]]; 

[email protected][exampleb = Table[{b, i, attrib1, attrib2, 
     RandomInteger[10000]}, {i, 21, 23}]]; 

Join[examplea, exampleb] // TableForm 

... 또는 당신이 그들을 가입 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[[email protected], [email protected]] // TableForm 
관련 문제