Cody

# Problem 733. Extract Built In Functions and Toolbox Functions from String or Function Handle

Solution 3492079

Submitted on 31 Oct 2020 at 13:57 by cokakola
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
fh_str='log2(x)+smooth3(x,y)+abs(2)+log10(5)'; exp_str='abs log10 log2 smooth3'; assert(isequal(find_functions(fh_str),exp_str))

5 : log2 0 : x 2 : smooth3 0 : x,y 5 : abs 0 : 2 5 : log10 0 : 5 0 :

2   Pass
fh_str='for k=log10(x):log2(x)+abs(x)'; exp_str='abs for log10 log2'; assert(isequal(find_functions(fh_str),exp_str))

5 : for 1 : k 5 : log10 0 : x 5 : log2 0 : x 5 : abs 0 : x 0 :

3   Pass
fh_str=@(x)x^2+sin(x)-cos(x); exp_str='cos sin'; assert(isequal(find_functions(fh_str),exp_str))

0 : @ 0 : x 0 : x 0 : 2 5 : sin 0 : x 5 : cos 0 : x 0 :

4   Pass
fh_str='@(x)x^2+sin(x)-cos(x)'; exp_str='cos sin'; assert(isequal(find_functions(fh_str),exp_str))

0 : @ 0 : x 0 : x 0 : 2 5 : sin 0 : x 5 : cos 0 : x 0 :

5   Pass
fh_str='filter2(x,A)+filter(x)-cos(x) expm(z)'; exp_str='cos filter expm filter2'; assert(isequal(find_functions(fh_str),exp_str))

2 : filter2 0 : x,A 5 : filter 0 : x 5 : cos 0 : x 2 : expm 0 : z 0 :

6   Pass
fh_str='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'; exp_str='abs filter numel sin filter2 smooth3'; assert(isequal(find_functions(fh_str),exp_str))

2 : smooth3 0 : x,y 5 : filter 0 : x 5 : abs 0 : n 2 : filter2 0 : u 5 : sin 0 : x 5 : numel 0 : z 0 :

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!