operation on a number of wave

Hi all
I was wondering what would be the best or a good way to perform operation on a number of waves, if they are in the same data folder and if they are in different data folders. It I were to use a loop, what would be an efficient way in moving between the folders or it would just be easier if just put all waves in the same data folder? Thanks!
Create a wave reference wave containing references to each of the waves you want to operate on and pass it as a parameter to the function that does the looping.

DisplayHelpTopic "Wave Reference Waves"
I used the wave reference but assigned the waves outside of the function
my function is as but get the expected assignment operator: =, +=, -+.. when trying to compile, what is wrong? thanks!

function mainroutine()
wave wind_direction_avg
WAVE wr
variable i

for (i=0;i<35;i=i+1)
WAVE  w =  wr[i]

string east = nameofwave(w) + "_east"
string west = nameofwave(w) +  "_west"
duplicate/o w $east, $west

$east =  wind_direction_avg < 180 &&  wind_direction_avg >0  ?   w :   nan
$west = wind_direction_avg <360 && wind_direction_avg > 180  ?  w  :  nan

endfor

end
you need to tell the compiler the wave type for the wave reference wave:

wave /wave wr
In addition to needing
WAVE/WAVE wr

instead of
WAVE wr

your use of $east and $west in wave assignment statements will not work. For details, execute:
DisplayHelpTopic "Wave References"


Here is an untested crack at correcting this issue:

Function mainroutine()
    Wave wind_direction_avg
    WAVE/WAVE wr
    Variable i
 
    for (i=0;i<35;i=i+1)
        WAVE w = wr[i]
 
        string eastName = nameofwave(w) + "_east"
        Duplicate/O w, $eastName
        WAVE eastWave = $eastName
        eastWave =  wind_direction_avg < 180 &&  wind_direction_avg >0  ? w : nan
       
        string westName = nameofwave(w) +  "_west"
        Duplicate/O w, $westName
        WAVE westWave = $westName
        westWave = wind_direction_avg <360 && wind_direction_avg > 180 ?  w : nan
    endfor
End

hrodstein wrote:
Create a wave reference wave containing references to each of the waves you want to operate on and pass it as a parameter to the function that does the looping. DisplayHelpTopic "Wave Reference Waves"
Wave-reference-waves are a great way to move data around in Igor. I'm wondering if there are plans to have Igor commands work directly with wave reference waves? For example, it would be useful to have the Display command work with wave-reference-waves so that all the referenced waves are displayed (instead of looping through the wave reference wave).