I have matlab_xunit, which is a folder with a bunch of functions used for writing unit tests. It’s stored in ../external/matlab_xunit. I want to call runtests which is part of this package. Here is the sample code:
addpath(genpath('../external/matlab_xunit'))
runtests subdirectory
subdirectory is a sub-directory of the current directory. What runtests does is that it will change the current directory to subdirectory, and then it will find the tests in that folder and run the tests. The problem is, as I found out, as soon as the current directory gets changed, matlab_xunit is no longer on the path. Thus, all functions runtests has to call inside become invalid – they just ‘vanish’.
Anyway around this shortcoming of addpath()?
Thanks much!
Use a full path. This will probably work: