Karan
Karan

Reputation: 15104

Colon difference in Matlab and Python

What is the equivalent to someArray(:,1,1) in python from Matlab?

In python someArray[:][0][0] produces a different value

Upvotes: 4

Views: 859

Answers (1)

mtrw
mtrw

Reputation: 35098

someArray[:,0,0] is the Python NumPy equivalent of MATLAB's someArray(:,1,1). I've never figured out how to do it in pure Python, the colon slice operation is a total mystery to me with lists-of-lists.

Upvotes: 5

Related Questions