Code covered by the BSD License  

Highlights from
Canny edge detection in 2-D and 3-D

image thumbnail

Canny edge detection in 2-D and 3-D

by

 

10 Feb 2014 (Updated )

A Canny edge detector for two-dimensional image and three-dimensional volume data.

checkattributes(a, classes, attributes)
function ok = checkattributes(a, classes, attributes)
%CHECKATTRIBUTES is like VALIDATEATTRIBUTES but returns true or false
%   OK = CHECKATTRIBUTES(A,CLASSES,ATTRIBUTES) takes the same arguments as
%   VALIDATEATTRIBUTES, excluding the three optional arguments. However
%   CHECKATTRIBUTES returns true or false when VALIDATEATTRIBUTES would
%   return or throw an exception respectively.
%
%   See also VALIDATEATTRIBUTES.

try
    validateattributes(a, classes, attributes, 'checkattributes');
    ok = true;
catch ME
    if ~isempty(strfind(ME.identifier, ':checkattributes:'))
        ok = false;  % first argument failed the specified tests
    else
        rethrow(ME); % there was some other error
    end
end
end

Contact us