0

For example I ask in a question to write a function to take in an input which is a vector and return a scaler which is the sum of all the vector elements. This can be done using for loops. But let's say I don't want someone to use the inbuilt function sum. How do I check if a specific .m file contains inbuilt functions like sum or max?

1 Answer 1

2

If you want to check if a certain name name refers to a built-in function in your current path, use exist( 'name', 'file' ) == 5.

If you want to list all the built-in dependencies within a matlab file, use the second output of depfun. For example if I want to check if file foo.m uses the built-in function bar, I could do:

[~,builtin_dep] = depfun('foo.m','-quiet');
ismember( 'bar', builtin_dep )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.