Can someone tell me what the error "invalid matrix token" means? I am using the following script in a for loop (j as iterator) in order to graph and add a box for limits. However, the script is giving me the matrix error. Can someone give me a hint?
I've tried loading this script to try it out for myself, but there are a couple of errors in it (there's a comma missing at the end of the "expr(x22)" line plus one mismatched bracket at the end). Correcting these as I'm assuming they should be corrected gives the program below, which I've tried running on one of the supplied data sets as shown: it crashes because it doesn't know what "xT" is. I can see another reason it might not work, namely that xmax, xmin, ymax and ymin aren't defined in this data set, but since I don't have your data I don't know what values these should take:
Another thought: the problem looks as if it involves inserting numbers into the script as opposed to variable names. In such cases I usually create a block of text which contains the script I know I want to run, and then parse it.
For example, suppose I wanted to add a property called "Cutoff" to the "Height" column of Big Class, and I wanted the value of Cutoff to be whatever number is held in a variable called CutoffValue, which is currently 60. My first guess might be to do it like this:
The advantage of the above is that if it still isn't working, at least you can write the expression to the log to make sure you've got the syntax right. I sometimes write entire blocks of script like this when they get seriously complicated: perhaps you could do something similar with your script too.
Thanks for responding. This script is part of a much larger script involving importing a list of column names to plot. I will post the script here but you will not be able to test it. If you see better practices, I am all ears.
The issue is, in fact, trying to insert a value from a variable. In this case, I want to use it in "Add Graphics Script" to create a box at the limits of the columns I am plotting. I have done something similar before by using substitute and eval statements into formulas of columns. However, it is not working for this particular case. When I look at the resulting graphics script of the graph, it is printed exactly as the code is stated and the values are not substituted.
I think I finally understand eval but I am not sure I understand the parse function. Are you suggesting that the actual script string be assigned to a variable (using parse)? I can try this but my question is do I evaluate the script variable before I run the "Add Graphics Script" line or during. I am afraid that if I do it during, I will not get the result I want.
here is the script. I hope it is formatted as nicely as yours. The portion in question is currently commented out and I have used adding reference lines temporarily. I would love to get it to work as originally planned.
David, I got it to work. The key was to use the parsing thing. I had to create the script to send to the report after the graph had been created. It seems like I should be able to do it within the graph creation itself but this works for me. Thanks for your help, that little coding went a long way.