Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
simply delete the vector index j in WRITETEXT. Depending on the nature of your function f it might be necessary to apply vectorization. In case of your simple identity function f(x):=x it would not be necessary, but I would always apply vectorization in such situations.
As you can see there is no need for any range variable.
If your main intention was to just use the first 501 elements of the 1001 element vector, you would have to use the "submatrix" function:
Even another option is to parametrize t;
Depends on your use case and personal preferences which option to choose.
What you did is a misuse of a range variable. A range variable is an implicit loop, kind of programming.
f(t[j) is an invalid object - you can see this when you try to assign it a variable using F:=f(t[j). You will get an error message doing so.
Of course you could write F[j := f(t[j) and this would work OK because now the range j is used for one of its three use cases, indexing a vector/matrix.
BTW, here is an alternative to create a vector like t
simply delete the vector index j in WRITETEXT. Depending on the nature of your function f it might be necessary to apply vectorization. In case of your simple identity function f(x):=x it would not be necessary, but I would always apply vectorization in such situations.
As you can see there is no need for any range variable.
If your main intention was to just use the first 501 elements of the 1001 element vector, you would have to use the "submatrix" function:
Even another option is to parametrize t;
Depends on your use case and personal preferences which option to choose.
What you did is a misuse of a range variable. A range variable is an implicit loop, kind of programming.
f(t[j) is an invalid object - you can see this when you try to assign it a variable using F:=f(t[j). You will get an error message doing so.
Of course you could write F[j := f(t[j) and this would work OK because now the range j is used for one of its three use cases, indexing a vector/matrix.
BTW, here is an alternative to create a vector like t