Skip to main content
1-Visitor
March 13, 2012
Solved

Setting and array equal to elements of another

  • March 13, 2012
  • 2 replies
  • 1990 views

I want to take select elements of one array and use them to initiaize another I am subsampling an array. For example:

i = 0;10

A=i

B=[1,3,6]

Now I want:

C[0] = A[1]

C[1] = A[3]

C[2] = A[6]

Of course for my real case the arrays are very large.

Is there a simple way to do this similar to matlab, using arry B to index into A? At this point I have to use a program but I expect there is a nice way to do this with something like C= A[B

Thanks

Fritz

Best answer by Fred_Kohlhepp

You're very close. ORIGIN in mathcad defaults to 0

2 replies

23-Emerald I
March 13, 2012

You're very close. ORIGIN in mathcad defaults to 0

1-Visitor
March 14, 2012

Thank you Fred. I had a syntax error in my "subscripts of subcripts" and your example helped me to figure it out.

Cheers!

Fritz