How to "dowindow" for waves
ychen344
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.
April 3, 2020 at 07:48 am - Permalink
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"
April 3, 2020 at 09:02 am - Permalink
In a function:
if( WaveExists(w) )
// do something with wave reference w
Print w[0]
endif
In a macro:
// do something with wave nameOfWaveThatMightNotExist
Print nameOfWaveThatMightNotExist[0]
endif
April 3, 2020 at 09:55 am - Permalink
What about using duplicate/O?
April 3, 2020 at 09:56 am - Permalink
In reply to What about using duplicate/O? by jjweimer
How do I fit in make/N=4 to "duplicate/O wave1", i.e., to define wave1 a "4 row" wave?
Can I write the following? Thanks.
duplicate/O $wave1_name
make/N=4 $wave1_name
wave wave1=$wave1_name
April 3, 2020 at 11:59 am - Permalink
It may be best to explain what you really want to do.
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.
April 3, 2020 at 12:35 pm - Permalink
In reply to It may be best to explain… by jjweimer
The first one is what I need: make a new wave (overwrite when it already exists). Thanks.
April 3, 2020 at 12:44 pm - Permalink
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.
April 3, 2020 at 01:01 pm - Permalink