Table Of Contents

User-Defined Function Calls

    Last Modified: January 2, 2017

    MathScript identifies user-defined functions by filename. The name of the file must be the same as the name of the function.

    You can call user-defined functions from MathScript code inside a MathScript Node or from another user-defined MathScript function. Both the MathScript Node and the user-defined functions must be in your project. You cannot define multiple functions in one .m file.

    Use the input and output arguments defined by a function definition in order to call the user-defined function. If you have, for example, a user-defined function named sumdifference.m in your project, use the following syntax to call the function from the MathScript Node:

    [sum, difference] = sumdifference(5, 9)

    If you define a user-defined function with the same name as a built-in function, MathScript executes the function you defined instead of the original function.

    Recently Viewed Topics