cimon wrote:
> a very simple question, "sometablename[[X]]" gives me the Xth row of
> table , like below.
>
> f = {{1, 2, 3, 4}, {1, 4, 6, 77}}
> {{1, 2, 3, 4}, {1, 4, 6, 77}}
> f[[1]]
> {1, 2, 3, 4}
>
>
> I am not able to find the syntax that can give me Xth column of a
> table. i dont want to transpose it and use. and I tried #,
f = {{1, 2, 3, 4}, {1, 4, 6, 77}};
f[[All, 2]]
(*Returns the second column without explicitly transposing. Read it as:
"Take all the rows and for each of these rows take only the second
element"*)
{2, 4}
(*Similarly, the following extracts the third element of the second row
only*)
f[[2, 3]]
6
You should read the short tutorial titled "Getting Pieces of Lists"
available in the documentation center or online at
http://reference.wolfram.com/mathematica/tutorial/GettingPiecesOfLists.html
Regards,
-- Jean-Marc