I have some about my program.Par exemple when I compile the program I see like this Error in Procedure: typrogram.How do you code in igo?Experimentmo.pxp(9.57 KB)
function tryprogram() String ctrlName variablei variable/G npt=4 Make/O/N=(npt) wavelength=ctrlName do(i=0)
wavelength[i]=2*i+1 while(i<npt) i+=1 end
It will compile like this:
function tryprogram() String ctrlName variablei variable/G npt=4 Make/O/N=(npt) wavelength i=0 do
wavelength[i]=2*i+1 i+=1// NOTE This is moved while(i<npt) end
It would also work like this:
function tryprogram(npt) variable npt Make/O/N=(npt) wavelength
wavelength=2*p+1 end
function tryprogram() String ctrlName variablei variable/G npt=4 Make/O/N=(npt) wavelength=ctrlName do(i=0)
wavelength[i]=2*i+1 while(i<npt) i+=1 end
It will compile like this:
function tryprogram() String ctrlName variablei variable/G npt=4 Make/O/N=(npt) wavelength i=0 do
wavelength[i]=2*i+1 i+=1// NOTE This is moved while(i<npt) end
It would also work like this:
function tryprogram(npt) variable npt Make/O/N=(npt) wavelength
wavelength=2*p+1 end
function tryprogram(npt) variable npt Make/O/N=(npt) wavelength=2*p+1 end
There are a lot of new things in this fragment. To be honest, it doesn't make sense to explain every little bit here.
Anyway a few things:
* Please use <pre><codeclass="language-igor"></xml> and <xml></code></pre> tags for posting code here.
* Start small.
(and not with buttons, loading waves etc.)
* Read The Fabulous Manual.
* Do the guided tour.
displayhelptopic"Getting Started"
* Read the online help related to the commands in your code sample.
- Press F1; go to the tab labeled Command Help; click in the list on the left; and type the initial characters of the respective command
OR
- Type displayhelptopic "#commandname#" in the command window (ctrl-j), e.g.
for ctrlName. I would like to create a table when I have value of wavelength[i].
...
I use this program for learn Igor programmation.
So, let's assume you mean this ...
Function MakeATableFromAWave(wavename) stringwavename
// make the table
return0 end
... where wavename is a string that is given in a call such as MakeATableFromAWave("myspectrum1"). Find the menu option that creates a table (Edit). Make all of the selections from the menu option. When you complete this menu option, a command appears in the history window. This command is what you will need to put in your function.
Otherwise as noted here and in other responses to your postings, we all would appreciate that you would spend some time to learn how to post Igor code, to read the manual, and to do the tutorials, especially on programming.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
Our video tutorials are at www.wavemetrics.com/products/igorpro/videotutorials.htm. There aren't any specific tutorials on programming, but in order to program in Igor you need to first be familiar with the application itself.
String ctrlName
variable i
variable/G npt=4
Make/O/N=(npt) wavelength=ctrlName
do (i=0)
wavelength[i]=2*i+1
while(i<npt)
i+=1
end
It will compile like this:
String ctrlName
variable i
variable/G npt=4
Make/O/N=(npt) wavelength
i=0
do
wavelength[i]=2*i+1
i+=1 // NOTE This is moved
while(i<npt)
end
It would also work like this:
variable npt
Make/O/N=(npt) wavelength
wavelength=2*p+1
end
What is your intention with ctrlName?
February 8, 2017 at 08:06 am - Permalink
February 9, 2017 at 12:20 am - Permalink
I see this program when he would like to plot Intensity vs wavelength. He use this program
Macro SpectreTotal(ctrlName) : ButtonControl
String ctrlName
KillWaves/Z Wavelength,Intensity
dowindow/K Graph0
dowindow/K Table0
LoadWave/A/G
String list = waveList("*", ";", "")
String traceName
variable i,lgond,cpix //correspondance pixel=cpix;longueur d'onde=lgond
String/G mypath=S_path
variable/G npt
traceName = StringFromList(0, list)
npt=pnt2x($traceName,numpnts($traceName)-1)+1 // N = numpnts(waveName)
Make/O/N=(npt) Wavelength=$traceName
traceName = StringFromList(1, list)
Make/O/N=(npt) Intensity=$traceName
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
lgond=K0*2
cpix=(lgond+29176.718286)/4587.899229
PRINT CPIX
do (i=0)
// Wavelength[i] = lgond + (512/cpix) - (i/cpix)
Wavelength[i] = lgond - (512/6.833) + (i/6.833) + 0.525
i+=1
while(i
edit Intensity,Wavelength
display /W=(10, 20, 600, 400) Intensity vs Wavelength
ModifyGraph rgb=(0,0,0)
//Label left "\\u#2Intensité (u.a.)";DelayUpdate
Label bottom "\\u#2longueur d'onde (A°)"
KillWaves/Z wave0,wave1
ShowInfo
End
I use this program for learn Igor programmation.
February 9, 2017 at 12:26 am - Permalink
variable npt
Make/O/N=(npt) wavelength=2*p+1
end
There are a lot of new things in this fragment. To be honest, it doesn't make sense to explain every little bit here.
Anyway a few things:
* Please use
<pre><code class="language-igor"></xml> and <xml></code></pre>
tags for posting code here.* Start small.
(and not with buttons, loading waves etc.)
* Read The Fabulous Manual.
* Do the guided tour.
* Read the online help related to the commands in your code sample.
- Press F1; go to the tab labeled Command Help; click in the list on the left; and type the initial characters of the respective command
OR
- Type
displayhelptopic "#commandname#"
in the command window (ctrl-j), e.g.HJ
February 9, 2017 at 02:56 am - Permalink
February 9, 2017 at 03:03 am - Permalink
But there will be no way around reading the manual. I'm serious.
HJ
February 9, 2017 at 03:52 am - Permalink
So, let's assume you mean this ...
string wavename
// make the table
return 0
end
... where wavename is a string that is given in a call such as MakeATableFromAWave("myspectrum1"). Find the menu option that creates a table (Edit). Make all of the selections from the menu option. When you complete this menu option, a command appears in the history window. This command is what you will need to put in your function.
Otherwise as noted here and in other responses to your postings, we all would appreciate that you would spend some time to learn how to post Igor code, to read the manual, and to do the tutorials, especially on programming.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
February 9, 2017 at 05:15 am - Permalink
February 9, 2017 at 05:29 am - Permalink
February 9, 2017 at 05:58 am - Permalink
You may find this site useful as well ...
http://payam.minoofar.com/igor/
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
February 9, 2017 at 08:15 am - Permalink
February 9, 2017 at 01:27 pm - Permalink