简体   繁体   中英

How to call function that is being shadowed by another one earlier in the MATLAB search path?

By way of preamble, consider this example from Unix. Suppose that /some/path/foo and /some/other/path/foo are both available executables. Also, suppose that both /some/path and /some/other/path are present in the $PATH environment variable, with /some/path appearing first. Then, if I run

% foo

the foo that gets run is /some/path/foo . That's what the $PATH variable is all about.

Nevertheless , I can always invoke the other foo by referring to it by its full path, like this:

% /some/other/path/foo

IOW, once I refer to the command by its full path, no name resolution needs to happen, so $PATH plays no role in deciding which foo gets run.

Importantly, this mechanism does not require modifiying the $PATH variable. One just sidesteps it.


With this example in mind, does MATLAB provide a way (other than changing the search path) to run a function foo from a file different from the first candidate file in the MATLAB search path?

请参见MATLAB 函数句柄feval

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM