how to acces a wave from an external operation or function
| jjweimer | August 10, 2011 - 05:22 | ||
|---|---|---|---|
|
Your question is unfortunately so general that I would have difficulty answering it clearly without doing a full discussion of programming methods in Igor Pro. In short, the answer depends on what you mean by "information" from a wave. 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. -- |
|||
| emeds | August 10, 2011 - 05:42 | ||
|---|---|---|---|
|
I know, it is beacuse that i am really new with Igor. I am trying to write a programm, which will multiply the numbers in a table of twoo different waves. I need these values in my function to multiply them. in the both case i dont know how to access to my waves.. |
|||
| chozo | August 10, 2011 - 07:27 | ||
|---|---|---|---|
|
Ok, two super simple functions for your two cases: Function Calc1(wave1, wave2) 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: Function Calc2() 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 - 07:31 | |||
|---|---|---|---|
|
|
|||
| jjweimer | August 10, 2011 - 07:32 | ||
|---|---|---|---|
|
What you are asking suggests again that you may first need a broader understanding of the basics of programming in Igor Pro. At the risk of sounding as though I am not answering your question ... I recommend that you read and WORK THROUGH the examples in Volume IV - Programming in the Manual. My answer to your question would likely repeat much of what is already found there. -- |
|||
| April 27, 2012 - 07:55 | |||
|---|---|---|---|
|
The title of your post says "external". All the answers have focussed on using waves in user-defined functions, and it sounds like that is what you want. We use the word "external" to refer to functions and operations defined in C or C++ code in a plug-in module. I mention this just in case everyone is giving you answers to a different question :) John Weeks |
|||


Joined: 2011-08-10
Location: Germany
Hello ,
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.