
Can you tell why this doesn't work

Ifroska
WAVE w
String name
Make/D/N=100 $name
$name[0]=w[0]
end
This function doesn't compile and IGOR tells me that "Can't use $ in this wau in a function"
How can I create a wave with the name I want and modify it in the same function?
Thanks a lot, I'm just starting on IGOR and this has been causing me trouble
April 29, 2010 at 04:34 pm - Permalink
The Wave statement has both run-time and compile-time functionality. At compile time, it tells Igor's compiler what sort of object is named, and provides a stand-in name for the wave whose name is not known yet.
At run-time, the Wave statement actually causes Igor to go looking for a wave with the name extracted from the contents of the string expression, and connects the local symbol (W_dummy in this case) with the real object.
Read more about this by executing these commands on Igor's command line:
DisplayHelpTopic "Converting a String into a Reference Using $"
DisplayHelpTopic "Compile Time Versus Runtime"
DisplayHelpTopic "Accessing Global Variables And Waves"
DisplayHelpTopic "Accessing Waves In Functions"
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 29, 2010 at 05:00 pm - Permalink
April 29, 2010 at 05:35 pm - Permalink