May I suggest a good tip for you Cadence users?
If you run simulations from the Affirma environment, you can add waveforms to plot after simulation. You might also know that you can add a calculator expression to the waveform? For example the difference between two waveforms:
VT("/net1") - VT("/net2")
However, try also to add a general function here! You can define the function in the CIW and add it to your list of plots. For example:
The function can then contain a lot more of actions, file writing, loading, etc.
I sometimes also add load command to a file I have somewhere in my search path. So for example
and then you can add your commands to that file. The advantage is that the file is reloaded every time and picks up all changes automagically.