/utility/istype.m

http://acq3.googlecode.com/ · MATLAB · 31 lines · 15 code · 6 blank · 10 comment · 5 complexity · bcb94f04a8add214ba252a625199620a MD5 · raw file

  1. function type_flag = istype(h_object, object_type);
  2. % ISTYPE - verify object type
  3. %
  4. % FLAG = ISTYPE(H_OBJECT, TYPE) determines whether H_OBJECT is a valid
  5. % object handle whose 'Type' property equals the character string TYPE.
  6. % See Handle Graphics Objects under the MATLAB Helpdesk for more detail
  7. % on object types.
  8. % By: S.C. Molitor (smolitor@bme.jhu.edu)
  9. % Date: January 25, 1999
  10. % check input arguments
  11. type_flag = 0;
  12. if (nargin ~= 2)
  13. return
  14. elseif (length(h_object) ~= 1)
  15. return
  16. elseif (~ishandle(h_object))
  17. return
  18. elseif (~ischar(object_type))
  19. return
  20. end
  21. % check for object handle existence & appropriate type
  22. if (strcmp(get(h_object, 'Type'), object_type))
  23. type_flag = 1;
  24. end
  25. return