cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Stack the range variables

ptc-4719666
1-Visitor

Stack the range variables

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,

ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:ptc-4719666)

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.

View solution in original post

9 REPLIES 9
RichardJ
19-Tanzanite
(To:ptc-4719666)

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.

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,

RichardJ
19-Tanzanite
(To:ptc-4719666)

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.

Thanks again~!

A couple of alternatives using pre-defined functions. Might be worth a look.

Very nice worksheet~:D

Thank you for your help!

No problem. Did you manage to follow them?

Yes, I am trying ~:D

Werner_E
25-Diamond I
(To:ptc-4719666)

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.

Announcements

Top Tags