The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Hi,
In the attached I show a simple example of referencing a matrix element with two approaches. When I use ORIGIN:=1 the second method fails. Is this due to my incorrect use of the second method?
The 1st method uses the matrix index from Vector/Matrix Operators menu. The 2nd method is just A(row,col).
thanks,
russ
Solved! Go to Solution.
No, its not due to an incorrect use on your side but rather a confusing implementation on side of PTC.
The matrix referencing where you use the matrix like a function (your second method) is not documented (or I could not find the doc in the help maze). I find it confusing because a matrix is no function and I would not recommend using this method.
PTC seems to have implemented this way of accessing matrix elements in a way so that it is not considering the current value of ORIGIN. It ignores the setting of ORIGIN and always assigns the index value 0 to the first element. This may even be an advantage as you can write function which works independent on the current ORIGIN setting but it sure is confusing especially when you compare it with and are used to the "normal" way of accessing matrix elements.
So you have the choice to either constantly keep in mind that one method is dependent and the other independent of ORIGIN, or to basically use only one of the two methods and ignore the other.
BTW, there are other functions which ignore the value of ORIGIN. For example the function "matrix". Its third argument is a function in two arguments which are interpreted as row and column number. It always assumes the first element to be number 0, no matter what you set ORIGIN to.
No, its not due to an incorrect use on your side but rather a confusing implementation on side of PTC.
The matrix referencing where you use the matrix like a function (your second method) is not documented (or I could not find the doc in the help maze). I find it confusing because a matrix is no function and I would not recommend using this method.
PTC seems to have implemented this way of accessing matrix elements in a way so that it is not considering the current value of ORIGIN. It ignores the setting of ORIGIN and always assigns the index value 0 to the first element. This may even be an advantage as you can write function which works independent on the current ORIGIN setting but it sure is confusing especially when you compare it with and are used to the "normal" way of accessing matrix elements.
So you have the choice to either constantly keep in mind that one method is dependent and the other independent of ORIGIN, or to basically use only one of the two methods and ignore the other.
BTW, there are other functions which ignore the value of ORIGIN. For example the function "matrix". Its third argument is a function in two arguments which are interpreted as row and column number. It always assumes the first element to be number 0, no matter what you set ORIGIN to.