how to acces a wave from an external operation or function
emeds
i am new to Igor and need some help :)
How can i access to an wave to get the information from it if i use it in a operation or function which i am programming?
thanks.
I recommend that you perhaps start by reading the examples for operations or functions already in Igor Pro. You might even try copying them to your procedure window, setting the debug mode on, setting a break=point in the procedure window, and watching what happens to the different parameters in the functions as the code steps through each line.
Otherwise, maybe I misunderstand and you have a more specific question that could be answered.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
August 10, 2011 at 06:22 am - Permalink
I could do it in two ways right?
one of them is if i invoke my function with 2 different waves ? like CalcSomething(wave0,vawe1)
or i can access these two waves in my function in my code?
in the both case i dont know how to access to my waves..
August 10, 2011 at 06:42 am - Permalink
case 1: pass two waves to a function
Wave wave1, wave2 // tell igor that two waves are coming int
// these names are placeholders; you can call the funciton with any two waves (names), i.e. 'calc1(this, that)'
// do something simple: e.g. multiply values of wave2 to wave1
wave1 = wave1 * wave2 // multiply wave1 and wave2 and write it back to wave 1
// OR: you may want to make a third wave inside the function (make ... ) to hold the values instead
Make/N=(DimSize(wave1, 0)) newwave // make a new wave with the same (1dim) size as wave1
newwave = wave1 / wave2 // divide wave1 by wave2 and write into newwave
End
Thats the common way to do it. You can also hardcode waves into your function as in case 2:
Wave wave1 = root:mywave_no1 // tell igor what for waves to use
Wave wave2 = root:mywave_no2 // here two waves 'mywave_no1', 'mywave_no2' in the root folder are being used
wave1 = wave1 + wave2 // add wave1 and wave2 and write it back to wave 1
End
However that is NOT recommended, because the waves have to exist in the exact folder with the exact names as written in the function, which is usually not the case. I use this quick and dirty way sometimes for tests, but otherwise you should use case 1.
If you want to learn more, start reading the subchapter 'user defined functions' in the chapter 'programming' in the manual.
August 10, 2011 at 08:27 am - Permalink
August 10, 2011 at 08:31 am - Permalink
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
August 10, 2011 at 08:32 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 27, 2012 at 08:55 am - Permalink