test if a scilab macro exists or not

rouxph rouxph.22 at gmail.com
Sun Jun 12 15:47:53 CEST 2011


Hi,


i need to test existence of "deprecated/obsolete" functions in scilab.
i've believed that it was possible with "exists" or "isdef" but i 
realize that there is somethings i don't understand in this! For example 
consider that i would like to test existence of "sort" (deprecated and 
should be replaced by "gsort")  :



-->exists('sort')
  ans  =

     0.

-->exists('gsort')
  ans  =

     0.

-->isdef('sort')
  ans  =

   F

-->isdef('sort','all')
  ans  =

   F

although "gsort" exists and "sort" doesn't exists :

-->sort([1,2])
             !--error 4
Variable non définie: sort



-->gsort([1,2])
  ans  =

     2.    1.


another example with "maxi" (obsolete and should be replaced by "max")

-->exists('max')
  ans  =

     0.

-->exists('maxi')
  ans  =

     0.

-->maxi=max//now maxi exists
  maxi  =


-->exists('maxi')
  ans  =

     1.

-->isdef('max')
  ans  =

   F

-->isdef('maxi')
  ans  =

   T



this seems very strange to me, since "max" and "maxi" has the same type 
("fptr" and not "function") but are considered differently :

-->typeof(max)
  ans  =

  fptr

-->typeof(maxi)
  ans  =

  fptr

i also think in using "whereis" but this also obscure to me :

-->whereis(max)
              !--error 999
whereis : Mauvais type pour l'argument d'entrée n°1.


-->whereis('max')
  ans  =

      []

-->whereis(imshow)
  ans  =

  sivplib

so i' wait for your ideas!

Philippe.




More information about the users mailing list