Unable to execute Function within Macro
Neurons
The general format is:
Macro MacroName([variables])
[define variables]
Function ConvertToSIUnits(w, loopnumber)
[create new waves in SI units]
End
Do
ConvertToSIUnits ("wavename", loopnumber)
[calculations on created waves]
While [loopnumber still makes sense]
End
[define variables]
Function ConvertToSIUnits(w, loopnumber)
[create new waves in SI units]
End
Do
ConvertToSIUnits ("wavename", loopnumber)
[calculations on created waves]
While [loopnumber still makes sense]
End
I've tested the Function on its own in the Command Window with actual waves and numbers, and it works fine. Enter exactly the same code into the Macro, and it no longer works, and throws no error messages. Once I get this working I'd like to generalize so the number can be replaced by i, a loop variable.
what surprises me is that your function is defined in a macro. I never do like this. I dont have igor at hand so I can not test it. If this function defination way works, it would be realy great: one can create functions in run time!
July 27, 2017 at 04:07 pm - Permalink
Hope that helps.
July 27, 2017 at 05:05 pm - Permalink
define the function outside macro, call the function in the loop in the macro. you can pass the wave you want to recalculate to the function by wave reference. in macro, you can reference wave just using wave names.
July 27, 2017 at 08:11 pm - Permalink
With rare exceptions (mostly recreation macros), you should not use macros at all. For details, execute:
DisplayHelpTopic "Macros"
July 27, 2017 at 07:44 pm - Permalink