Matlab addpath() does not stick on the path when current directory is changed? -


i have matlab_xunit, folder bunch of functions used writing unit tests. it's stored in ../external/matlab_xunit. want call runtests part of package. here sample code:

addpath(genpath('../external/matlab_xunit')) runtests subdirectory 

subdirectory sub-directory of current directory. runtests change current directory subdirectory, , find tests in folder , run tests. problem is, found out, current directory gets changed, matlab_xunit no longer on path. thus, functions runtests has call inside become invalid - 'vanish'.

anyway around shortcoming of addpath()?

thanks much!

use full path. work:

addpath(genpath(fullfile(pwd,'../external/matlab_xunit'))) 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -