简体   繁体   English

如何在MATLAB搜索路径中调用之前被另一个阴影的函数?

[英]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. 作为序言,请考虑Unix中的这个例子。 Suppose that /some/path/foo and /some/other/path/foo are both available executables. 假设/some/path/foo/some/other/path/foo都是可用的可执行文件。 Also, suppose that both /some/path and /some/other/path are present in the $PATH environment variable, with /some/path appearing first. 另外,假设$PATH环境变量中存在/some/path/some/other/path ,首先出现/some/path Then, if I run 然后,如果我跑

% foo

the foo that gets run is /some/path/foo . 运行的foo/some/path/foo That's what the $PATH variable is all about. 这就是$PATH变量的全部内容。

Nevertheless , I can always invoke the other foo by referring to it by its full path, like this: 然而 ,我总是可以通过它的完整路径引用它来调用另一个foo ,如下所示:

% /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. IOW,一旦我通过其完整路径引用命令,就不需要进行名称解析,因此$PATH在决定运行哪个foo时不起作用。

Importantly, this mechanism does not require modifiying the $PATH variable. 重要的是,这种机制不需要修改$PATH变量。 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是否提供了一种方法(除了更改搜索路径之外)从不同于MATLAB搜索路径中第一个候选文件的文件运行函数foo

请参见MATLAB 函数句柄feval

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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