Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
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,
Solved! Go to Solution.
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.
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,
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
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.