exist() for functions only?
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Daniel
      
 el 19 de Dic. de 2014
  
    
    
    
    
    Comentada: Sean de Wolski
      
      
 el 22 de Dic. de 2014
            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 comentarios
  Sean de Wolski
      
      
 el 22 de Dic. de 2014
				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
      
      
 el 22 de Dic. de 2014
				For functions only, this blog post and ensuing comments explains:
Respuesta aceptada
  matt dash
      
 el 19 de Dic. de 2014
        An option that is not exactly what you describe, but might work for you:
isempty(which([functionname,'.m']))
5 comentarios
Más respuestas (1)
  Azzi Abdelmalek
      
      
 el 19 de Dic. de 2014
        
      Editada: Azzi Abdelmalek
      
      
 el 19 de Dic. de 2014
  
      exist()==2
%or
A = exist('name','file')
Ver también
Categorías
				Más información sobre File Operations en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




