1
$\begingroup$

I have a tensor of a variable size as an input to a function in which I need to access specific elements. Because the order of this tensor is variable, notation:

tensor[[i,j,k...]]

is not an option. In MATLAB I would have a solution to the effect of:

access_array = [a,b,c,d,...];
tensor(access_array)

however this type of solution does not seem to work in Mathematica, and the documentation does not propose an equivalent. Here is what I tried:

acc={a,b,c}
tensor[[acc]]

Thank you for your help, Slava

$\endgroup$
  • $\begingroup$ Maybe Extract[] is more appropriate for you than Part[]? $\endgroup$ – J. M. will be back soon Jul 26 '17 at 15:24

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.