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?
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.
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
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.
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..
Ok, two super simple functions for your two cases:
case 1: pass two waves to a function
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
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
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.
Open the Igor PDF manual, go to Chapter IV-3, "User-Defined Functions", and read the section "Accessing Waves in Functions". Better yet, start from the beginning of that chapter because it introduces concepts that you will need to understand that section.
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.
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 :)
Back to top