GetFormula unexpected error
josh.liptonduffin
Hi all, I am receiving a weird error that I can't understand:
function printFormula(wave w)
//a valid wave is passed in at the call
string s = getFormula(w) // <--Throws execution error 'expected wave or variable'
print s
end
//a valid wave is passed in at the call
string s = getFormula(w) // <--Throws execution error 'expected wave or variable'
print s
end
I don't understand why getFormula() is throwing an error here. If I enter the same code on the execution line of the debugger (or even on the command line) it works fine.
I can confirm, at least on IP9 and Mac OS. IP7 and 8 seem to work as expected.
April 7, 2022 at 01:33 am - Permalink
Confirmed that it works correctly in IP8 on MacOS, but throws the error under IP8 under Windows 10.
April 7, 2022 at 04:33 pm - Permalink
It works correctly in a function only if the parameter name exactly matches the wave name.
This is true all the way back to Igor 6!
I'm working on a fix to Igor 9 (Igor 8 is no longer being updated, sorry)
April 8, 2022 at 12:03 pm - Permalink
A workaround is to get the wave's full path and use $:
String path=GetWavesDataFolder(w,2)
string s = getFormula($path)
print s
end
April 8, 2022 at 01:52 pm - Permalink