Cody

# Problem 43025. Check if a directory is on the current MATLAB search path

Solution 1052510

Submitted on 14 Nov 2016
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
str = '/opt/mlsedu/matlab/R2016b/toolbox/matlab/mss/mlt_rmt_tmw/scoring-engine'; assert(isequal(isonpath(str),true))

2   Pass
str = '/opt/mlsedu/matlab/R2016b/toolbox/matlab/testframework/parallel'; assert(isequal(isonpath(str),true))

3   Pass
str = '/opt/mlsedu/matlab/R2016b/toolbox/shared/imageslib'; assert(isequal(isonpath(str),true))

4   Pass
str = '/opt/mlsedu/matlab/R2016b/help/toolbox/vision/examples'; assert(isequal(isonpath(str),true))

5   Pass
str = '/opt/mlsedu/matlab/R2016b/toolbox/shared/bigdata'; assert(isequal(isonpath(str),true))

6   Pass
str = '/opt/mlsedu/matlab/R2016b/toolbox/matlab/demos'; assert(isequal(isonpath(str),true))

7   Pass
str = '/opt/mlsedu/matlab/R2016b/toolbox/matlab/funfun'; assert(isequal(isonpath(str),true))

8   Pass
str = '/opt/mlsedu/matlab/R2016b/toolbox/matlab/system'; assert(isequal(isonpath(str),true))

9   Pass

10   Pass
str = ''; assert(isequal(isonpath(str),false))

11   Pass
str = '/opt/'; assert(isequal(isonpath(str),false))

12   Pass
str = 'matlab'; assert(isequal(isonpath(str),false))

13   Pass
str = '/matlab/R2016b/toolbox'; assert(isequal(isonpath(str),false))

14   Pass
str = 'not a directory'; assert(isequal(isonpath(str),false))

15   Pass
str = '/opt/mlsedu/matlab/R2016b/toolbox/matlab/timefun/fakedirectory'; assert(isequal(isonpath(str),false))

16   Pass
str = 'blah/blah/blah'; assert(isequal(isonpath(str),false))

17   Pass
str = 'C:\Program Files\MATLAB\R2016a\toolbox\matlab\datafun'; assert(isequal(isonpath(str),false))

18   Fail
str = []; assert(isequal(isonpath(str),false))

Error using cell/ismember (line 34) Input A of class double and input B of class cell must be cell arrays of character vectors, unless one is a character vector. Error in isonpath (line 4) ismember(str, strsplit(p,':')); Error in TestPoint18 (line 2) assert(isequal(isonpath(str),false))