Simple question, but the solution is apparently so obvious that I can't see it. Am trying to write a very simple hook that will eventually set variables whenever the cursor is moved on the graph of a multidimensional wave, but my use of StringByKey is giving me errors. What am I doing wrong here?
function cursormovedhook(info)string info
printxcsr(stringbykey("cursor", info))end
I get errors telling me that I'm missing a right parenthesis. I know the hook is no longer the recommended way to do things, but I was expecting that it would be a quick fix.
xcsr is expecting a real string and not a string variable.
It's actually expecting a name, not a string. $ turns a string into a name. For example:
Make jack=sin(x/8), joe=cos(x/8)Display jack // jack is a nameString aString = "joe"AppendToGraph aString // Wrong - AppendToGraph will look for a wave named aStringAppendToGraph$aString// OK - $aString returns a name taken from the contents of aString
For details:
DisplayHelpTopic"Converting a String into a Reference Using $"
compiles here fine. xcsr is expecting a real string and not a string variable.
December 21, 2012 at 04:39 am - Permalink
It's actually expecting a name, not a string. $ turns a string into a name. For example:
For details:
December 21, 2012 at 05:47 am - Permalink
Nathan
December 21, 2012 at 06:24 am - Permalink