我在.m文件中定义了一些MATLAB函数,我想将它们导入到MATLAB中(因为我希望能够将它们称为内置函数).我怎样才能做到这一点?
我对MATLAB搜索路径有一些疑问:
当前目录位于搜索路径上,但为什么它不在"path"的输出中?我在哪里可以找到完整的搜索路径?
添加搜索路径的所有可能方法是什么?
考虑添加搜索路径的所有可能方法(例如pathdef.m,startup.m,MATLABPATH env变量等),添加的搜索路径的顺序是什么?我认为这很重要,因为当不同搜索路径中存在同名文件时,将选择顶部的文件.
首先,这里是我调用函数的方式:
eval([functionName '(''stringArg'')']); % functionName = 'someStringForTheFunctionName'
Run Code Online (Sandbox Code Playgroud)
现在,我functionName在我的路径中有两个功能,一个接受stringArg另一个功能,另一个接受其他功能.我遇到了一些错误,因为现在它找到的第一个错误是没有错误的函数stringArg.考虑到我调用functionName函数的方式,如何调用正确的函数?
编辑:
我试过这个功能which:
which -all someStringForTheFunctionName
Run Code Online (Sandbox Code Playgroud)
结果 :
C:\........\x\someStringForTheFunctionName
C:\........\y\someStringForTheFunctionName % Shadowed
Run Code Online (Sandbox Code Playgroud)
阴影函数是我想要调用的函数.
matlab ×3
function ×2
directory ×1
file ×1
import ×1
include ×1
overloading ×1
path ×1
search-path ×1