"Can't use $ in this way in a function"
rfreeman057
Function SwWave(a bunch of parameters)
Wave PositiveWave, NegativeWave
I use Sprintf to make strings that correspond to two wave names. The strings are called PosWavename and NegWavename and correspond to data waves that I have.
Before doing the comparisons, I try to set the value of these waves equal to the waves defined earlier as PositiveWave and Negative Wave
PositiveWave=$PosWavename
NegativeWave=$NegWavename
It fails at this point and gives me the error, "Can't use $ in this way in a function". If anyone has any knowledge that could help I'd greatly appreciate it.
Also attached the file, just in case my barebones description wasn't enough.
Your code has statements like this:
Wave PositiveWave,NegativeWave
Sprintf PosWavename "%s%-5.3f", PosWavePrefix, Temperature[h] // Your code does not contain the needed String PosWavename statement to create a local string
...
PositiveWave=$PosWavename
It is important to remember that a WAVE statement is BOTH a declaration AND an assignment, so
Sprintf PosWavename "%s%-5.3f", PosWavePrefix, Temperature[h]
...
Wave PositiveWave
PostiveWave= $PosWavename // wrong, Igor thinks you're trying to modify the CONTENTS of a global wave named PositiveWave
is different than:
Sprintf PosWavename "%s%-5.3f", PosWavePrefix, Temperature[h]
...
Wave PostiveWave= $PosWavename // right, Igor understands you're creating a local reference to a global wave using the name stored in the local PosWavename string.
And I'm not a big fan of passing parameters into a function through global strings like SVAR; that's what function parameter arguments are for.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
July 18, 2012 at 03:58 pm - Permalink
July 19, 2012 at 08:50 am - Permalink
July 19, 2012 at 09:23 am - Permalink