You construct a handle for a specific function by preceding the function name with an @ sign. The syntax is:
h = @functionname
where h is the variable to which the returned function handle is assigned.
Use only the function name, with no path information, after the @ sign. If there is more than one function with this name, MATLAB® associates with the handle the one function source it would dispatch to if you were actually calling the function.
Create a handle h for a function plot that is on your MATLAB path:
h = @plot;
Once you create a handle for a function, you can invoke the function by means of the handle instead of using the function name. Because the handle contains the absolute path to its function, you can invoke the function from any location that MATLAB is able to reach, as long as the program file for the function still exists at this location. This means that functions in one file can call functions that are not on the MATLAB path, local functions in a separate file, or even functions that are private to another folder, and thus not normally accessible to that caller.
You construct a handle for a specific function by preceding the function name with an @ sign. The syntax is:
h = @functionname
where h is the variable to which the returned function handle is assigned.
Use only the function name, with no path information, after the @ sign. If there is more than one function with this name, MATLAB® associates with the handle the one function source it would dispatch to if you were actually calling the function.
Create a handle h for a function plot that is on your MATLAB path:
h = @plot;
Once you create a handle for a function, you can invoke the function by means of the handle instead of using the function name. Because the handle contains the absolute path to its function, you can invoke the function from any location that MATLAB is able to reach, as long as the program file for the function still exists at this location. This means that functions in one file can call functions that are not on the MATLAB path, local functions in a separate file, or even functions that are private to another folder, and thus not normally accessible to that caller.
การแปล กรุณารอสักครู่..