I wrote a code which gives me a list which has one coordinate point (for example {{10,11}})

I was wondering how i can only take the y part (which is 11)

I tried using:

data2 = b[[1 ;; 0]]

but that eliminates both parts


The double semicolon syntax list[[i ;; j]] gives you a span of elements, not different levels. So, with l = {a,b,c}, l[[2 ;; 3]] gives {b,c}. You'll want to use commas instead! Note also that Mathematica lists start at 1, not 0.

So you'll want b[[1, 2]]. This is equivalent to b[[1]][[2]], giving the first part of {{10,11}}, which is {10,11}, and then the second part of that, which is 11.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.