function componentDir = componentExamplesDir(component)
%

%   Copyright 2017-2020 The MathWorks, Inc.

componentDir = fullfile(matlabroot,'examples',component);
examplesXml = fullfile(componentDir,'examples.xml');

if ~isfile(examplesXml)
    try
        componentDir = fullfile(matlabshared.supportpkg.getSupportPackageRoot, 'examples', component);
    catch
    end
    examplesXml = fullfile(componentDir,'examples.xml');
    if ~isfile(examplesXml)
        error(em('InvalidArgument',component))
    end
end

function m = em(id,varargin)
m = message(['MATLAB:examples:' id],varargin{:});
