Several functions of matlab7

xiaoxiao2021-03-06  96

Source: http://genial.yculblog.com/post-117202.html

MATLAB provides several different functions that can be applied in the program: A. Anonymous function: It is a simple form of the MATLAB function, no M files are required. It contains only a MATLAB expression, any multiple inputs and outputs. You can define it in the MATLAB command window or M function file or in a script file. Syntax: f = @ (arglist) Expression. For example: sqr=@ (xi )x.^2; call format is A = SQR (5); (explained with Inline) B. Sub-function and subsidiary: All non-anonymous functions need to be defined in the m file. Each M file requires a master that appears in the M file first. The range of main functions is wide than the sub function. That is, the main function can be called outside the M file (in the command window or other M file), and the subunies can not. The subunies are only visible in the main function and other subunies of the M file. C. Private function: Private function is one of the main M file function. Its unique feature is that it can only be visible in a specific qualified function group. This is useful if you want to constrain the function of the function, or when you choose not to see which function you perform, this is useful. Private function resides (put) under subditonic named privacy named. They are only visible to functions in their parent directory. E.g:…. Because the private function is an unacceptable to the external (parental), they can use the same name as the functions of the functions in other directories. This is useful when you want to create a new version of your own specific function, want to save the original version of the function in the additional directory. Because Matlab first querying private functions, look for standard M functions. D. Nested function: You can define functions inside any of the MATLAB M function. They are called the nesting function of external functions. This note, MATLAB previous version is not supported within a function: function x = nestfun (p1, p2) x1 = NestFunin (P2); function y = nestfunin (p3) y = 2 * p3; End x = x1 p1; End, A and D are the functions that the previous version is not available, but I feel that D is not worth advocating.

转载请注明原文地址:https://www.9cbs.com/read-124109.html

New Post(0)