Pause in 'for' loop with opportunity to work with other windows
Physicist92
Hi all,
Is there possibility to make a pause in 'for' loop with the opportunity to work with other windows within Igor Pro? I tried to use DoAlert, but this command doesn't allow to perform actions in other windows. For example, I have a data set of 20 experimental graphs. I use loop for(i=0; i<numItems; i+=1). First, i = 0, display graph, then pause to allow me to perform manual fitting in selected range using specified panel with a number of buttons. Second, i = 1, display graph, then pause to do fitting, and so on. How can I implement it?
Here is the main function:
Function Fit_Semilog()
DoWindow/F FittingPanel
if (V_Flag != 0)
return 0
endif
NewPanel /N=FittingPanel /K=1 /W=(316,379,680,700) as "Fitting Panel"
Button FitInFullRange,pos={30.00,20.00},size={300.00,20.00},proc=FitInFullRangeProc,title="Fit in full range"
Button Show_Info,pos={30.00,50.00},size={300.00,20.00},proc=Show_InfoProc,title="Show Info"
Button Hide_Info,pos={30.00,80.00},size={300.00,20.00},proc=Hide_InfoProc,title="Hide Info"
Button FitInSelectedRange,pos={30.00,110.00},size={300.00,20.00},proc=FitInSelectedRangeProc,title="Fit in selected range"
Button SubtractFitValFromFirstPart,pos={30.00,140.00},size={300.00,20.00},proc=SubtractFitValFromFirstPartProc,title="SubtractFitValFromFirstPart"
Button RemoveFitFromGraph,pos={30.00,170.00},size={300.00,20.00},proc=RemoveFitFromGraphProc,title="Remove fit from Graph"
Button TryAgain,pos={30.00,200.00},size={300.00,20.00},proc=TryAgainProc,title="Try again"
Button SaveGraph,pos={30.00,230.00},size={300.00,20.00},proc=SaveGraphProc,title="Save Graph"
Button Continue_,pos={30.00,260.00},size={300.00,20.00},proc=Continue_Proc,title="Continue"
String listX = WaveList("*Time",";","")
String listY = WaveList("*Int",";","")
Variable numItems = ItemsInList(listY)
Variable i
String nameY, nameX
for (i=0; i<numItems; i+=1)
nameX = StringFromList(i,listX)
nameY = StringFromList(i,listY)
Wave wX = $nameX
Wave wY = $nameY
Display wY vs wX
ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,65535)
Display wY vs wX
ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,65535)
Display wY vs wX
ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,65535)
// Here should be a pause with opportunity to work with other windows
endfor
End
macro FitSemilog()
Fit_semilog()
end
DoWindow/F FittingPanel
if (V_Flag != 0)
return 0
endif
NewPanel /N=FittingPanel /K=1 /W=(316,379,680,700) as "Fitting Panel"
Button FitInFullRange,pos={30.00,20.00},size={300.00,20.00},proc=FitInFullRangeProc,title="Fit in full range"
Button Show_Info,pos={30.00,50.00},size={300.00,20.00},proc=Show_InfoProc,title="Show Info"
Button Hide_Info,pos={30.00,80.00},size={300.00,20.00},proc=Hide_InfoProc,title="Hide Info"
Button FitInSelectedRange,pos={30.00,110.00},size={300.00,20.00},proc=FitInSelectedRangeProc,title="Fit in selected range"
Button SubtractFitValFromFirstPart,pos={30.00,140.00},size={300.00,20.00},proc=SubtractFitValFromFirstPartProc,title="SubtractFitValFromFirstPart"
Button RemoveFitFromGraph,pos={30.00,170.00},size={300.00,20.00},proc=RemoveFitFromGraphProc,title="Remove fit from Graph"
Button TryAgain,pos={30.00,200.00},size={300.00,20.00},proc=TryAgainProc,title="Try again"
Button SaveGraph,pos={30.00,230.00},size={300.00,20.00},proc=SaveGraphProc,title="Save Graph"
Button Continue_,pos={30.00,260.00},size={300.00,20.00},proc=Continue_Proc,title="Continue"
String listX = WaveList("*Time",";","")
String listY = WaveList("*Int",";","")
Variable numItems = ItemsInList(listY)
Variable i
String nameY, nameX
for (i=0; i<numItems; i+=1)
nameX = StringFromList(i,listX)
nameY = StringFromList(i,listY)
Wave wX = $nameX
Wave wY = $nameY
Display wY vs wX
ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,65535)
Display wY vs wX
ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,65535)
Display wY vs wX
ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,65535)
// Here should be a pause with opportunity to work with other windows
endfor
End
macro FitSemilog()
Fit_semilog()
end
DisplayHelpTopic "pause for user"
May 13, 2019 at 04:17 am - Permalink
In reply to DisplayHelpTopic "pause for… by tony
Thank you!
May 13, 2019 at 09:16 am - Permalink