List of fitting functions for a menu

Before using this, give the function a different name.
Function/S NewGF_FitFuncList()

    string theList="", UserFuncs, XFuncs

    string options = "KIND:10"
    options += ",SUBTYPE:FitFunc"
    options += ",NINDVARS:1"

    UserFuncs = FunctionList("*", ";",options)
    UserFuncs = RemoveFromList("GFFitFuncTemplate", UserFuncs)
    UserFuncs = RemoveFromList("GFFitAllAtOnceTemplate", UserFuncs)
    UserFuncs = RemoveFromList("NewGlblFitFunc", UserFuncs)
    UserFuncs = RemoveFromList("NewGlblFitFuncAllAtOnce", UserFuncs)
    UserFuncs = RemoveFromList("GlobalFitFunc", UserFuncs)
    UserFuncs = RemoveFromList("GlobalFitAllAtOnce", UserFuncs)

    XFuncs = FunctionList("*", ";", "KIND:12")

    if (strlen(UserFuncs) > 0)
        theList +=  "\\M1(   User-defined functions:;"
        theList += UserFuncs
    endif
    if (strlen(XFuncs) > 0)
        theList += "\\M1(   External Functions:;"
        theList += XFuncs
    endif

    if (strlen(theList) == 0)
        theList = "\\M1(No Fit Functions"
    endif

    return theList
end

This function is used in the Global Fit package to present a menu of candidate fit functions.
It includes gray items that separately label user-defined functions and XFUNC fitting functions.
Among other things, it filters out user-defined functions lacking the FitFunc subtype keyword.

The incremental building of options at the top of the function is partly a
leftover from when Global Fit had a checkbox that allowed you to optionally
list only functions with the FitFunc subtype. Note that XFuncs don't have
subtypes, so it's impossible to filter out non-fit XFuncs that have the
same signature as a fitting function.

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More