Can you tell why this doesn't work

Function test(w,name)
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
you have to create a wave reference, i.e:

Function test(w,name)
    WAVE w
    String name

    Make/D/N=100 $name
    Wave nameWave = $name
    nameWave[0]=w[0]
end
Wave references and the $ operator can be pretty baffling.

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