Skip to main content
1-Visitor
April 7, 2014
Solved

Stack the range variables

  • April 7, 2014
  • 2 replies
  • 3474 views

Dear Mathcad community,

I am trying to stack two range variables which are N1:=1..130 and N2:=200..300.

Is there anyway to combine those two range variables N1 and N2.

Sincerely,

Best answer by RichardJ

No, you cannot combine them. A range variable is not a vector. It contains only three pieces of information: the start, the step size, and the end. It's basically a loop variable, ot iterator. You need to create two vectors, and stack them.

2 replies

RichardJ19-TanzaniteAnswer
19-Tanzanite
April 7, 2014

No, you cannot combine them. A range variable is not a vector. It contains only three pieces of information: the start, the step size, and the end. It's basically a loop variable, ot iterator. You need to create two vectors, and stack them.

1-Visitor
April 7, 2014

Thank you for your reply. Now the definition is clear to me.

I have a follow up question.

I have a vector 2048 rows and 1 column. I want to remove the data points at 131 row through 200 row. That is removing 69 rows in a vector.

The 'submatrix' function does not work. Is there any better solution?

Thank you.

Sincerely,

19-Tanzanite
April 8, 2014

You need to use stack, with two submatrix functions as arguments. Assuming ORIGIN=0 use this function:

NewV(V,s1,s2):=stack(submatrix(V,0,s1-1,0,0),submatrix(V,s2+1,last(V),0,0))

If 131 and 200 are the indicies of the vector then s1=131 and s2=200.

25-Diamond I
April 7, 2014

In Mathcad range variables are implicit for loops and not data structures like vectors. That said stack can't work,

You may want to read the articles by Stuart I posted here http://communities.ptc.com/message/238888#238888 to better understand the difference between ranges and vector and how ranges should be used.