error message: Display-expected wave name
Troubleshooting.
Got the following error message when running the macro "Create pupContriction layout"
"While executing Display, the following error occured: expected wave name."
The waves are already created and stored in the data folder.
======================================================
menu "Macros"
"Create pupConstriction layout", pupConstrictionLayoutDialog()
end
function pupConstrictionLayoutDialog()
string patient_number, patient_ID, testDate
prompt patient_number, "Enter patient number"
prompt patient_ID, "Enter patient ID"
prompt testDate, "Enter testDate in yyyymmdd"
DoPrompt "Enter testing info", patient_number, patient_ID, testDate
if (V_flag)
return 0
endif
dowindow/K layout0
newlayout/P=portrait
TextBox/C/N=text0/F=0/A=LB/X=5.00/Y=97 "ID: "+patient_number+"-"+patient_ID+"_"+testDate
TextBox/C/N=text5/F=0/O=90/A=LB/X=0.5/Y=80 "Pupil diameter (mm)"
TextBox/C/N=text8/F=0/O=90/A=LB/X=0.5/Y=55 "Constri Vel (mm/s)"
TextBox/C/N=text6/F=0/O=90/A=LB/X=0.5/Y=30 "Pupil diameter (mm)"
TextBox/C/N=text9/F=0/O=90/A=LB/X=0.5/Y=5 "Constri Vel (mm/s)"
TextBox/C/N=text7/F=0/A=LB/X=44.00/Y=1 "Time (sec)"
TextBox/C/N=text1/F=0/A=LB/X=80.00/Y=95 "Trial 1, OD"
TextBox/C/N=text2/F=0/A=LB/X=80.00/Y=70 "Trial 1, OS"
TextBox/C/N=text3/F=0/A=LB/X=80.00/Y=45 "Trial 2, OD"
TextBox/C/N=text4/F=0/A=LB/X=80.00/Y=20 "Trial 2, OS"
variable d //representing #trials
variable e //representing recEye in a trial (OD if e=1 and OS if e=2)
string recEye
for (d=1; d<2; d=d+1)
for (e=1; e<2; e=e+1)
if (d==1)
recEye="OD"
elseif (d==2)
recEye="OS"
endif
string trialName="trial"+num2str(d)
string graphName="graph"+recEye
string pupwavename="PDmm_"+recEye+"_deBlinked"
wave pupwave=$pupwavename
string velwavename="PDmm_"+recEye+"_velocity"
wave velwave=$velwavename
wave timeWave
dowindow/K $graphName
display/N=$graphName :$(trialName):pupwave vs timeWave
AppendToGraph/W=$graphName/L=L2 :$(trialName):velwave vs timeWave
ModifyGraph/W=$graphName rgb(pupwave)=(65280,0,0)
ModifyGraph/W=$graphName rgb(velwave)=(0,0,65280)
ModifyGraph/W=$graphName axisEnab(left)={0.55,1},axisEnab(L2)={0,0.45}
ModifyGraph/W=$graphName freePos(L2)={0,kwFraction}
SetAxis left 0,8
SetAxis L2 -1,1
string stimMarkerR1_x_name="stimMarkerR1_x_"+recEye
string stimMarkerB1_x_name="stimMarkerR1_x_"+recEye
string stimMarkerR2_x_name="stimMarkerR1_x_"+recEye
string stimMarkerB2_x_name="stimMarkerR1_x_"+recEye
string stimMarkerR1_y_name="stimMarkerR1_y_"+recEye
string stimMarkerB1_y_name="stimMarkerR1_y_"+recEye
string stimMarkerR2_y_name="stimMarkerR1_y_"+recEye
string stimMarkerB2_y_name="stimMarkerR1_y_"+recEye
AppendToGraph/W=$graphName/R=R1 :$(trialName):$stimMarkerR1_y_name vs $stimMarkerR1_x_name
AppendToGraph/W=$graphName/R=R1 :$(trialName):$stimMarkerB1_y_name vs $stimMarkerB1_x_name
AppendToGraph/W=$graphName/R=R1 :$(trialName):$stimMarkerR2_y_name vs $stimMarkerR2_x_name
AppendToGraph/W=$graphName/R=R1 :$(trialName):$stimMarkerB2_y_name vs $stimMarkerB2_x_name
ModifyGraph noLabel(R1)=1
ModifyGraph rgb($stimMarkerR1_y_name)=(0,0,0)
ModifyGraph rgb($stimMarkerB1_y_name)=(0,0,0)
ModifyGraph rgb($stimMarkerR2_y_name)=(0,0,0)
ModifyGraph rgb($stimMarkerB2_y_name)=(0,0,0)
ModifyGraph freePos(R1)={0,kwFraction}
appendlayoutobject/T=1/W=$"" graph $graphName
endfor
endfor
end
Do not paste here this much code, or at least format it as Igor code. This is close to impossible to read...
....
dowindow/K $graphName
display/N=$graphName :$(trialName):pupwave vs timeWave
This Display command makes no sense. It is impossible to define pupwave as wave reference above and then try to redirect that to specific folder location.
Wave reference ("wave pupwave=") needs to point to specific existing wave in its location (in the folder).
This looks like you took Macro code (without wave references) and changed to to function code (where wave references are required) without fixing all those references etc. This looks like you need to read Igor manual about Macros, Functions, wave references etc.
April 6, 2020 at 09:59 am - Permalink
Please also use the debugger to step through the execution of the code. We can help troubleshoot, but we do prefer that you could do some basic ground work on your own first.
April 6, 2020 at 11:08 am - Permalink
In reply to Please also use the debugger… by jjweimer
I enabled debugger but the debug window did not show up in procedure window.
April 6, 2020 at 05:49 pm - Permalink
In reply to Do not paste here this much… by ilavsky
This is not helpful... I eventually figured it out and got what I needed. All you needed to tell me was that "you had to use the true wave name when referring a wave in a folder."
I am not a professional programmer; at times it just does not work by reading Igor Manual. There are not much video Igor tutorials, especially for programming. Video tutorials would be more helpful.
April 6, 2020 at 05:57 pm - Permalink
You seem to be disappointed, but please be considerate of others who try to help you in their free time without anything in return. Please don't be offended, but you have the habit of posting a lot of code and expect other to find their way and present you with ready answers. All we are implying is that you could find many things yourself by using the tools available already (extensive manual, debugger etc.), which would also speed up the process for you since you didn't have to wait for the answer in the forum. There is some upfront cost for you to learn, but in the long run it will pay off greatly, since Igor can be used in many powerful ways which makes your daily data crunching easier.
Also, it would be a nicer way of asking questions by doing some upfront work and isolate the problem as much as possible, i.e., identify the minimum amount of code to replicate the problem and if possible post a minimum work experiment file which demonstrates the problem. In the name of a friendly together here in the forum, I link to the top two post in this forum:
https://www.wavemetrics.com/forum/general/formatting-code-forum-posts
https://stackoverflow.com/help/how-to-ask
April 6, 2020 at 08:00 pm - Permalink
To echo chozo more bluntly, I suggest that your concluding attitude might have managed to make a few folks here less inclined to help you in the future when you really may need it. Reflect in the mirror the next time you hear a “you are not helpful” reply thrown somewhat caustically at you. It is neither polite nor professional.
Clearly, you are rewriting a program that someone else gave you written in a language that you do not fully understand and generated using tools that you do not fully appreciate. This is a hard job that will require time and patience while causing various levels of frustration. I cannot believe that videos would help directly, even while I agree that more videos about programming in Igor Pro would be helpful in general.
Let’s see where you go for your next posting. In the meantime, it is good to hear that you resolved your problem.
April 6, 2020 at 09:35 pm - Permalink
In reply to This is not helpful... I… by ychen344
Well, sorry for trying to help. I will not do that mistake again. I
However, the request for more movies is something I know way too well.... I keep being asked by "Youtube generation" users of my tools for more movies all the time. Can you make movie on "how do I fit this or that". They just do not seem to be able to read, I guess, anymore. The main problem is, that every time I make movie on something, its information content density is dreadfully low. It is either simplistic overview of the problem with very little breath - or, it is long and complicated beast which anyone, especially "Youtube-damaged" generation, cannot follow anyway. Movies for introduction to simple linear "how to" process are great. More complicated stuff, not so much.
Igor has great learning tools, even for programming. One just need to spend time walking through them from simple problem to more complex one, step by step. I know, I have few students/colleagues who went through this recently.
April 7, 2020 at 12:51 pm - Permalink