>> x1 = array2table(rand(3))
x1 =
3×3 table
Var1 Var2 Var3
_______ ________ _______
0.77917 0.56882 0.33712
0.93401 0.46939 0.16218
0.12991 0.011902 0.79428
>> x2 = array2table(randn(3),'VariableNames',{'Var4' 'Var5' 'Var6'})
x2 =
3×3 table
Var4 Var5 Var6
________ ________ ________
-0.88803 0.30352 0.73936
0.10009 -0.60033 1.7119
-0.54453 0.48997 -0.19412
>> x = [x1 x2]
x =
3×6 table
Var1 Var2 Var3 Var4 Var5 Var6
_______ ________ _______ ________ ________ ________
0.77917 0.56882 0.33712 -0.88803 0.30352 0.73936
0.93401 0.46939 0.16218 0.10009 -0.60033 1.7119
0.12991 0.011902 0.79428 -0.54453 0.48997 -0.19412
>> x = x(:,[(1:3)+[0;3]])
x =
3×6 table
Var1 Var4 Var2 Var5 Var3 Var6
_______ ________ ________ ________ _______ ________
0.77917 -0.88803 0.56882 0.30352 0.33712 0.73936
0.93401 0.10009 0.46939 -0.60033 0.16218 1.7119
0.12991 -0.54453 0.011902 0.48997 0.79428 -0.19412
Best Answer