exist() for functions only?
2 次查看(过去 30 天)
显示 更早的评论
As I understand, the exist() function in MATLAB will return "2" if the input is a MATLAB function.
The list of options for the second input 'kind' are builtin, class, dir, file, and var.
I want to input 'kind' so that exist() will ONLY search for functions, and return 2 if it is a match to a function and a 0 if not.
Is there any way to do this?
2 个评论
Sean de Wolski
2014-12-22
So you mean ONLY functions or any MATLAB files that will run (scripts/functions/classes)? which will return something for scripts and classes as well.
Sean de Wolski
2014-12-22
For functions only, this blog post and ensuing comments explains:
采纳的回答
matt dash
2014-12-19
An option that is not exactly what you describe, but might work for you:
isempty(which([functionname,'.m']))
5 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!