0
$\begingroup$

I have a very large 3D List, out of which - for example - the first element reads:

In[12]:= A = Zeropi1pEvents[[1]]

Out[12]= {{1, 3, 902, -1, 0.00001322118, 0., 0., 0., 0.8353713, \
-0.1763927, -0.1532843, 0.7950288, 0, 2, 1.097166}, {1, 3, 1, 0, \
0., 0., 0., 0., 0.8863627, -0.02104685, -0.06873666, -0.01801131, 0, \
2, 1.097166}, {1, 3, 1, 0, 0.00001322118, 0.9189929, 0.113536, \
22.09291, 1.09887, 0.02276057, -0.0158158, 0.5717545, 1002001, 2, \
1.097166}, {1, 3, 1, 1, 0.00001322118, 1.622211, 4.360793, \
-7.01601, 0.9692001, 0.01591564, 0.0176974, -0.2428701, 1002001, 2, \
1.097166}}

I now want to get the 9th element of one of these sublists.

So - for example - I take

In[14]:= B = A[[1]]

Out[14]= {1, 3, 902, -1, 0.00001322118, 0., 0., 0., 0.8353713, \
-0.1763927, -0.1532843, 0.7950288, 0, 2, 1.097166}

This obviously works as it should. Now I want to get the 9th element of this list B. I do B[[9]]and get an error:

In[15]:= B[[9]]

During evaluation of In[15]:= Part::partd: Part specification {1, 3, 902, -1, 0.00001322118, 0., 0., 0., 0.8353713, -0.1763927, -0.1532843, 0.7950288, 0, 2, 1.097166}[[9]] is longer than depth of object.

Out[15]= {1, 3, 902, -1, 0.00001322118, 0., 0., 0., 0.8353713, \
-0.1763927, -0.1532843, 0.7950288, 0, 2, 1.097166}[[9]]

What is going wrong here? What is the correct way to get the 9th element of one of the sublists of A?

$\endgroup$
  • $\begingroup$ With Zeropi1pEvents[[1,9]] you will get the 9th element of the first list in your list of lists. $\endgroup$ – vi pa Jun 17 at 9:45
  • $\begingroup$ Your code runs without error (Mathematica v12(windows) $\endgroup$ – Ulrich Neumann Jun 17 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.