MATLAB Functions Help Desk

inline

Purpose

Construct an inline object

Syntax

Description

inline(expr) constructs an inline function object from the MATLAB expression contained in the string expr. The input argument to the inline function is automatically determined by searching expr for an isolated lower case alphabetic character, other than i or j, that is not part of a word formed from several alphabetic characters. If no such character exists, x is used. If the character is not unique, the one closest to x is used. If there is a tie, the one later in the alphabet is chosen.

inline(expr,arg1,arg2, ...) constructs an inline function whose input arguments are specified by the strings arg1, arg2,.... Multicharacter symbol names may be used.

inline(expr,n), where n is a scalar, constructs an inline function whose input arguments are x, P1, P2, ...

Remarks

Three commands related to inline allow you to examine an inline function object and determine how it was created.

char(fun) returns the string that can be used to recreate the inline function object. This is the opposite of the constructor inline.

argnames(fun) returns the names of the input arguments of the inline object fun as a cell array of strings.

formula(fun) returns the formula for the inline object fun.

Examples

Create a simple inline function to square a number:

Create an inline function to compute the formula :



[ Previous | Help Desk | Next ]