[Matlab] feval使用
2015-06-26 10:51
645 查看
查看doc feval:[y1, y2, ...] = feval(fhandle, x1, ..., xn)[y1, y2, ...] = feval(fname, x1, ..., xn)
[y1, y2, ...] = feval(fhandle, x1, ..., xn) evaluates the function handle, fhandle, using arguments x1 through xn. If the function handle is bound to more than one built-in or .m function, (that is, it represents a set of overloaded functions), then the data type of the arguments x1 through xn determines which function is dispatched to.
[y1, y2, ...] = feval(fname, x1, ..., xn). If fname is a quoted string containing the name of a function (usually defined within file having a .m file extension), then feval(fname, x1, ..., xn) evaluates that function at the given arguments. The fname parameter must be a simple function name; it cannot contain path information.
意思很清楚,feveal就是把已知数据和符号带入已定义好的函数或函数句柄中,简单理解就是求函数的值用的。
例如:
假设需要调用的函数foo定义如下:
function x=foo(a,b)
x=a*b;
若在main函数中用feval调用foo,可以有以下几种方式1. result=feval('foo',3,15);
2. result=feval(@foo,3,16); %这里@foo即句柄等价于result = x(3,15)。
详细参见: http://www.cnblogs.com/begtostudy/archive/2012/06/27/2565920.html
[y1, y2, ...] = feval(fhandle, x1, ..., xn) evaluates the function handle, fhandle, using arguments x1 through xn. If the function handle is bound to more than one built-in or .m function, (that is, it represents a set of overloaded functions), then the data type of the arguments x1 through xn determines which function is dispatched to.
[y1, y2, ...] = feval(fname, x1, ..., xn). If fname is a quoted string containing the name of a function (usually defined within file having a .m file extension), then feval(fname, x1, ..., xn) evaluates that function at the given arguments. The fname parameter must be a simple function name; it cannot contain path information.
意思很清楚,feveal就是把已知数据和符号带入已定义好的函数或函数句柄中,简单理解就是求函数的值用的。
例如:
假设需要调用的函数foo定义如下:
function x=foo(a,b)
x=a*b;
若在main函数中用feval调用foo,可以有以下几种方式1. result=feval('foo',3,15);
2. result=feval(@foo,3,16); %这里@foo即句柄等价于result = x(3,15)。
详细参见: http://www.cnblogs.com/begtostudy/archive/2012/06/27/2565920.html
相关文章推荐
- matlab 数据预处理及常用操作
- [Matlab] @的使用
- matlab中自定义colormap的保存与调用
- vs2013 Matlab引擎 丢失libeng.dll
- sequential minimal optimization,SMO for SVM, (MATLAB code)
- PCA (主成分分析)详解 (写给初学者) 结合matlab
- caffe windows Matlab
- [Matlab]提高程序运行效率的方法[转]
- Matlab与C++混合编程(依赖OpenCV)
- MATLAB GUI界面总结(转载)
- CVX: Matlab Software for Disciplined Convex Programming
- matlab使用imhist、plot、fill画可填充颜色连续直方图
- Matlab中判断两个矩阵是否相等
- Matlab中plot函数全功能解析
- Matlab数值计算差商与插值
- matlab乘与点乘的区别 (*与.* ^与.^)
- matlab中用imshow()显示double类型图像中出现的问题
- matlab中norm函数的用法
- matlab echo 的用法
- 实验二:FFT算法的MATLAB实现