So I have the following (simplified) project structure.
scripts/
client.m
src/
+estimators/
@estimator1/
3party/
shell_script.sh
estimator1.m
Basically, what I try to do is, calling estimator1.m
from client.m
. This is working very well, no issues. However, from within estimator1.m
I try to call shell_script.sh
. The problem, relative paths do not work since it is always looking from the path client.m
is called.
What I tried from estimator1.m
is:
pathToScript = fullfile('3Party','shell_script');
system(pathToScript);
I would really like to avoid absolute paths since I'd like this package to be used by others as well. So hardcoding paths to my home directory is not good.
Use
mfilename('fullpath')
to get the full path of the currently executing file. Usefileparts
to get just the directory part. Putting it together,