Uses of function handles, MATLAB in Engineering

Uses of Function handles:

The Function handles can also be generated for functions other than anonymous functions, both built-in & user-defined functions. For illustration, the below would generate a function handle for the built-in factorial function:

>> facth = @factorial;

The @ operator acquiires the handle of the function, that is then stored in a variable facth.

The handle can be used to call the function, merely like the handle for the anonymous functions, for illustration:

>> facth(5)

ans =

120

By using the function handle to call the function rather than of using the name of the function does not itself elaborate why this is helpful, so a clear question would be why the function handles are essential.

 

Posted Date: 10/20/2012 6:47:27 AM | Location : United States







Related Discussions:- Uses of function handles, Assignment Help, Ask Question on Uses of function handles, Get Answer, Expert's Help, Uses of function handles Discussions

Write discussion on Uses of function handles
Your posts are moderated
Related Questions

Matrix definitions: As we know the matrix can be thought of as a table of values in which there are both rows and columns. The most common form of a matrix A (that is sometime

Illustration of Image processing: This displays that there are 64 rows, or in another word, 64 colors, in this specific colormap. It also displays that the first five colors a

Matrix operations: There are some common operations on matrices. The operators which are applied term by term, implying that the matrices should be of similar size, sometimes

Creating Cell arrays: There are many ways to create cell arrays. For illustration, we will create a cell array in which one element will store an integer, one element store ch

readlenwid function: function call: [length, width] = readlenwid; function header: function [l,w] = readlenwid In the function call, not any argument is passed; henc

Splits a string : The strtok function splits a string into pieces; it can be called in many ways. The function receives one string as an input argument. It appears for the fir

Finding a sting - function strfind: The function strfind does necessarily similar thing, except that the order of the arguments does make dissimilarity. The common form is str

Example of Plotting from a Function: For illustration, the function can be called as shown below:      >> y = [1:2:9].^3      y =     1  27  125  343  729

Vectors of Structures: In numerous applications, involving database applications, information generally would be stored in the vector of structures, instead of in individual s