Add 'Invert Wave' to graph contextual menu

I wanted to be able to right click on a trace on a graph and have the wave from which the trace was created inverted (ie. multiplied by -1). Here's some code I used to do this:

Menu "TracePopup"
    "-"         // separator divides this from built-in menu items
    "Invert wave", /Q, InvertWave()

// Invert the wave that the user selected.  Note that this inverts the wave itself
// and not just the trace.
Function InvertWave()
    // determine the wave name based on the trace name and window name
    WAVE targetWave = TraceNameToWaveRef(S_graphName, S_traceName)
    targetWave *= -1

You can just copy and paste this code into a procedure file and compile. If you want this behavior to occur from any experiment whenever you start Igor Pro, you'll need to create a stand alone procedure file containing this code and put a shortcut/alias to that procedure file in your Igor Procedures directory.




Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More