Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi all
MC15
I want to create range variable like i:=1,2,3,5 to use it in iterations like
a.i:=i for example
Now I`ve to use index vector i={1 2 3 5}T inside program loop for this.
Is it possible to create noncontinuous range variable?
Many thanks in advance
Solved! Go to Solution.
While we're waiting for Stuart's request to be finally implemented in Prime version N...
you don't necessarily need to program, if you can live with...Well it's basically what Fred described above:
Success!
Luc
The definition for a range variable precludes this: first, second , , last. If you need a noncontiguous step as you've described, create a vector of integers rather than a range variable. Then you can use the integers in that vector as indices in your loop.
Is it possible to create noncontinuous range variable?
A range variable does not store a list of values, it stores the start, the increment, and the end. So no, that is not possible.
Very sad it will simplify worksheet a lot
You may store the indexes, known a priori and with variable integer increment, in a vector and then, with a loop, recall, associating them to an integer index of an element of a vector in a matrix on which to do the calculations.
Attached there is an example quite complicated.
I know about vector possibility, but in this case I need to use a loop instead of ellegant one row string))
You may store the indexes, known a priori and with variable integer increment, in a vector V and then, with a loop index j, recall k=V[j], and then work on the vector U[k]
The previous attached file is the answer to another similar problem solved some months ago (proposed by aimtaz)
Your file contains a lot of files.Please attach only one).
Igor Fomenko wrote:
Hi all
MC15
I want to create range variable like i:=1,2,3,5 to use it in iterations like
a.i:=i for example
Now I`ve to use index vector i={1 2 3 5}T inside program loop for this.
Is it possible to create noncontinuous range variable?
Many thanks in advance
Not as you. I have a long standing request to allow such a feature, including by extending the concept of a sequence to allow arbitrary lists of values, such as 1,2,3,5 or (1..3),5. We can already do this in a programming for loop, so this change woukd mean we could do the same thing at worksheet level using the := operator.
Stuart
While we're waiting for Stuart's request to be finally implemented in Prime version N...
you don't necessarily need to program, if you can live with...Well it's basically what Fred described above:
Success!
Luc
Thank you very much LucMeekes.I forgot about this opportunity at all))).40 years old is not so good as 20)))
Which can be presented a little smaller by using i for the vector and . for its index (You'll have to use [Ctl-Shft-K] to enter the . symbol):