How to access a function under a given path?
显示 更早的评论
Greetings,
I am wonderin whether it is possible to call a function that is not located in the current directory, nor in a subfolder nor on the matlab path.
I want to call a function (with argument) based on the absolute path, where this funtion is located
Lets say I have a path saved in a variable, and I want to use the function
targetfunc
with the input argument 5.
targetdir = "A:\EI\OU";
Things like
targetdir\targetfunc(5)
obviously dont work, neither does
run
(which is made for scripts?)
The background of this is, that a script A shall clone a GIT repository to a specific folder ( another one in the same parent folder for now) and use a function that is located there.
- Adding the targetdir to path would work, but I want to try to work around this method, to minimize the risk of getting names double on the path
- Always creating an absolute pah to the function, that is called: I dont know how to call a function with an absolute path??
- changing current directory might also work, but afaik this is also bad style and opens the way for problems if I use other functions/scripts in the original script (A).
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Source Control 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!