I defined a function row2col[] to transform row into column, Where am I wrong?
row2col[args__] :=
Module[
{argList = {args}, n = Length[{args}], i},
col = {};
For[i = 1, i <= n, i++,
midd = Map[List, argList[[i]]];
col = Join[col, midd];
];
col
];
col = row2col[{1, 2, 3}, {4, 5, 6}, {7, 8, 9}];
MatrixForm[col]
Quit[];
The expexted result is
(*{{{1},{2},{3}},{{4},{5},{6}},{{7},{8},{9}}}*)
I know other simple command can return the result i need, I want to know what's wrong with my definition.


Tranpose[]– Jonathan Shock Mar 15 at 5:09{{1,2,3}}– rm -rf♦ Mar 15 at 5:29