I have a Matlab code that I have to convert into python. There is this one operation that I am currently struggling with. I have a Matlab array "edof" which has the dimensions 262144 x 24. I have a second array "dofVector" which has the dimensions 823875 x 1. The operation performed is:
edof = dofVector(edof);
which updates my variable and I get the resulting dimensions of the variable "edof" to be the same as before ie 262144 x 24 but the values are changed.
I am trying to convert this line of code in numpy but have been unable do so.
edof = dofVector[edof]
Can someone please help me here?
I am not including the description of the arrays here as this is highly technical and specific to my field.
Thank you!
Numpy indices are zero-based. MATLAB indices are one-based. So if edof
is identical between MATLAB and Python up to that step, you'll want to do
edof = dofVector[edof - 1]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.