programming data to be saved into a 2D wave
J_Aluko
Im quite new to Igor and am trying to learn it at the minute. i do have a bit of experience in programming, but the trouble im having at the minute is mainly syntax based. iv looked through the manual and everything but i think all the bits of information i need are scattered around the entire thing and so i was hoping someone would be able to consolidate it in my query:
Im trying to write a program that saves a sequence, whose limit is defined by interacting with the user via DoPrompt commands, to a 2D wave. i then want the wave to be plotted, and all using programming commands. is this possible? if so, any help would be greatly appreciated. even a short example program that uses the relevant commands would go a long way.
many thanks in advance
"Make Wave and Graph", menuMakeWaveAndGraph()
end
Function menuMakeWaveAndGraph()
Variable amp=1, tau=3, x1=0, x2=30
Prompt amp, "Amplitude:"
Prompt tau, "Decay Constant:"
Prompt x1, "Starting X value:"
Prompt x2, "Ending X value:"
DoPrompt "Make a Wave and Graph", amp, tau, x1, x2
if (V_flag == 0)
MakeWaveAndGraph(amp, tau, x1, x2)
endif
end
Function MakeWaveAndGraph(amp, tau, x1, x2)
Variable amp, tau, x1, x2
Make/N=200/O graphwave
SetScale/I x x1, x2, graphwave
graphwave = amp*exp(-x/tau)
Display graphwave
end
Copy that and paste it into the Procedure window (Windows menu->Procedure Windows->Procedure Window). Close the Procedure window. Now pull down the Macros menu and try it.
It is simpler than what you want, but it's a very simple example of the sorts of things you are talking about.
You can right-click on any of the commands there to get help on a command.
If you haven't done it yet, please do the Guided Tour (Help->Getting Started).
I suggest reading the Programming Manual, Chapters 1-3, 6-8 at a minimum. Don't worry if you don't get it the first time through. In my experience it takes several repeated readings to get comfortable.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
November 5, 2013 at 09:43 am - Permalink