Inline Functions in MATLAB Last Updated : 28 Sep, 2022 Comments Improve Suggest changes Like Article Like Report Inline functions are those functions that are defined in one line, also called one-liner for the same reason. In MATLAB there are two types of inline functions, inbuilt and user-defined. Let's take a look at both of them. InBuilt inline Functions:MATLAB has many mathematical functions built-in which are inline such as log(), sqrt(), sin(), etc. It also offers more complex mathematical functions as inline functions such as the beta and gamma functions, etc. Example 1: Matlab % Matlab code for InLine function sqrt(36) log(exp(1)) Output: User Defined Inline Functions:MATLAB provides the option to define inline functions in the script using the inline keyword. The syntax for the same is function_name = inline('expression', 'variable') The expression is the function's expression and the variable is the independent variable of the function. Example 2: Matlab % Matlab example for inline % user defined function func = inline(' x^3 + x^2 + x','x') Output: We can call this function with various parameters: Vectorized inline functions:Inline functions can be vectorized using the vectorize keyword. The syntax is function_name = inline(vectorize('expression'), 'variable') Example 3: Matlab % Matlab example for inline % vectorized function func = inline(' x^3 + x^2 + x','x') func(-1,3) func(0.5:1.5) Output: Conclusion:This article discussed how to use built-in inline functions of MATLAB and how to define inline functions in a MATLAB script. We also discuss all the various options that could be used with user-defined inline functions and how to call those functions with various parameters. Comment More infoAdvertise with us Next Article Inline Functions in MATLAB O owl0223 Follow Improve Article Tags : Software Engineering MATLAB-Functions Similar Reads Functions in MATLAB Methods are also popularly known as functions. The main aim of the methods is to reuse the code. A method is a block of code which is invoked and executed when it is called by the user. It contains local workspace and independent of base workspace which belongs to command prompt. Let's take a glance 5 min read Local Functions in MATLAB Functions in any programming language are some blocks of code, which could be reused whenever required, by just calling the name. It reduces so much of human effort and also rewriting of the same code, and makes the entire code big. Declaring a function:Before moving forward let's see how actually t 2 min read Inline and Anonymous Functions in MATLAB Methods are also popularly known as functions. The main aim of the methods is to reuse the code. A method is a block of code that is invoked and executed when it is called by the user. Inline FunctionInline functions are the kind of functions which is defined in one line. that's why this type of fu 4 min read Map Function in MATLAB A map function basically takes the elements of the array and applies a function to each element.  The resultant output is of the same shape as the array, but the values are the result of the function. In MATLAB, there is a similar function called arrayfun(), which we can be used to achieve the same 2 min read Function Handles in MATLAB Function Handles are a data type of MATLAB which represents a function. They store a function just like an ordinary variable store numeral or alphabetic data. An example of the same could be a function, say f1, that takes another function, f2, as its parameter; f2 calculates a mathematical function 2 min read Parse Function Inputs in MATLAB Basically, the parse function is a method that users use in the function to convert data from one format to another. In programming, parsing is the processing and analysis of strings of numbers. We can also say that the parse function is often used to convert strings to other data types such as numb 4 min read Find() function in MATLAB The find() function in MATLAB is used to find the indices and values of non-zero elements or the elements which satisfy a given condition. The relational expression can be used in conjunction with find to find the indices of elements that meet the given condition. It returns a vector that contains t 3 min read Nested Functions in MATLAB Functions in any programming language are some blocks of code, which could be reused whenever required, by just calling the name. It reduces so much of human effort and also rewriting of the same code, and makes the entire code big. Declaring a Function: To declare a function in MATLAB we use given 2 min read Void Function in MATLAB When defining void* output in the library definition file, MATLAB specifies that the argument MLTYPE must be one of these: a typedef from the library. Use only to produce scalar data. If the library has a typedef defined for void* that uses that name, MATLAB specifies MLTYPE as the new type name in 2 min read Mean Function in MATLAB Mean or average is the average of a sequence of numbers. In MATLAB, mean (A) returns the mean of the components of A along the first array dimension whose size doesn't equal to 1. Suppose that A is a vector, then mean(A) returns the mean of the components. Now, if A is a Matrix form, then mean(A) re 3 min read Like