![](https://secure.gravatar.com/avatar/d7a33f69d4fb125ee71b4bef74f8dc0f.jpg?s=120&d=mm&r=g)
Hi! All, I am also in the same process. And I would like to add one more question: In Matlab, for a 3D array or matrix, the indexing is a(i,j,k). In numpy, it became a[k-1,i-1,j-1]. Is there any way to make it become a[i-1,j-1,k-1]? Or I am doing something wrong here?? Gen On Apr 20, 2006, at 3:38 AM, David Cournapeau wrote:
Dear numpy users,
I am converting some code from matlab to numpy/scipy, but still a bit confused by numpy, mostly the array vs matrix issue. Looking at the scipy website, the matrix type looks the closest to matlab syntax, but I still have some issues:
- under matlab, everything, including scalar, are matrices in matlab sense. In python, they are not. So, of I want to handle scalar case in a function which takes arrays, what should I do ? Having special case for scalar sounds like a pain, so is asarray/asmatrix the best way to handle those cases so my function only deal with array types ? - what is the difference between matrix and array, except syntax ? If I want to handle both in one function, what is the "best" method ? Using one type only (for example matrix), and using asmatrix on all arguments accordingly ?
To convert my matlab code, I was thinking about using asmatrix for arguments in all my functions, but I am not sure this is really the "right" way. I was hoping some other people would have some experience with the same issues, and could give me some general advices
thank you,
David
P.S: it would be great to have this kind of information on scipy website; right now, the scipy for matlab users part is a bit sparse... I am willing to change this once I understand the problem myself, of course:)
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user