How to "dowindow" for waves

What is the "dowindow" equivalent for waves? I have used "killwaves" to clean up as follows:

      string wave1name

      killwaves $wave1name

      wave wave1=$wave1name

the program returns a message "while executing killWaves, the following error occured: expected wave name"

Thansk

The problem with your code is that the string wave1name is empty and so KillWaves does not know which wave to kill. What do you mean by DoWindow for waves? You can do NameOfWave(wave1) to retrieve the name, or just use KillWaves wave1 if the name does not vary.

What I'd like to do is to empty wave1 when running the script repeatedly on the same data folder. If wave1 is not empty, the program will return an error message: "wave1 already exits"

In a function:

WAVE/Z w= root:nameOfWaveThatMightNotExist
if( WaveExists(w) )
    // do something with wave reference w
    Print w[0]
endif

In a macro:

if( exists("nameOfWaveThatMightNotExist") == 1 )
    // do something with wave nameOfWaveThatMightNotExist
    Print nameOfWaveThatMightNotExist[0]
endif

 

It may be best to explain what you really want to do.

// make a new wave (overwrite when it already exists)
make/N=4/O mywave

// clear an existing wave back to zero
mywave = 0

// redimension an existing wave
redimension/N=3 mywave

// create a new wave from an existing wave
// overwrite as needed
duplicate/O mywave mynewwave

// remove a wave entirely from existence
killwaves/Z mywave

Also, the request that you need a "dowindow" operation for waves suggests that you have not yet thoroughly appreciated the sections in the user manual on the wave paradigm that is used Igor Pro. So perhaps a bit of background reading would help you.

I would like to strongly recommend the Guided Tour, part of our Getting Started help. Select Help->Getting Started. The Guided Tour is a step-by-step introduction to important Igor concepts. It will take some time, but it is well worth it.