Break a wave with $ reference?

When I run the below function, to add points at the beginning or end of a wave (loading the waves via string references), a tempwave wave is created in the current data folder. It is the default make wave (128 rows, each 0). If I include killwaves tempwave, however, the wave with name: sample +"_"+ stringfromlist(i,templist) is deleted.

Can I sever the connection between the dummy tempwave name and the actual name of the wave?

function wavepadding(prefstartpoint,prefendpoint,actstartpoint,actendpoint,sample,templist)
variable prefstartpoint,prefendpoint,actstartpoint,actendpoint

string sample, templist

variable i
make/o tempwave

string tempstring = sample +"_"+ stringfromlist(i,templist)

wave tempwave = $tempstring

insertpoints actendpoint, prefendpoint-actendpoint, tempwave
insertpoints prefstartpoint, actstartpoint-prefstartpoint, tempwave



<pre><code class="language-igor">
In your sample you are not even using the made tempwave. But I suppose this is a test routine from something more complex.

To kill the actual tempwave rather than what the tempwave WAVE reference points to, you can do one of the following:

wave tempwave = $"tempwave"
KillWaves tempwave

or just

KillWaves $"tempwave"

You could also use a free wave and not bother with a KillWaves like so
Make/FREE tempwave

Larry Hutchinson
Hmm...I didn't think wave could actually create the label "tempwave," only load it or assign string names to it. Does it work differently when assigning a string reference to it?
This makes a wave and also automatically makes a wave reference named temp wave which points to the wave just made:
make/o tempwave

This makes a wave reference named tempwave that points to an already-existing wave whose name is stored in a string:
string tempstring = sample +"_"+ stringfromlist(i,templist)
wave tempwave = $tempstring

I don't know why you are making a wave named tempwave. It seem more likely that you just need the wave reference.

For details execute:
DisplayHelpTopic "Wave References"
Yeah, I only need the wave reference. I was augmenting some old code for this purpose and copied the make command. But I felt it should be there, since I didn't think wave could create a new wave reference, but I see I was wrong.

Thanks for your help.