function isLibrary = bdIsLibrary(bdnames)
%bdIsLibrary - Returns whether or not a loaded block diagram is a library
%
%   isLibrary = bdIsLibrary(bdnames)
%
% bdnames can be a string, a cell array of strings, or a double array.
% All strings must be the names of loaded block diagrams.  It is an error to
% supply a path to a block or subsystem, or the name of a block diagram that
% is not loaded.  All doubles must be the handles of loaded block diagrams.
% It is an error to supply an invalid handle, or the handle of anything other
% that a block diagram.
%
% isLibrary is a logical array with one entry for each block diagram.
%
% Examples:
%  load_system({'sf_car','hydlib','vdp'})
%  h = get_param('hydlib','Handle')
%
%  bdIsLibrary('sf_car') % returns logical scalar
%  bdIsLibrary({'hydlib','vdp'}) % returns 1*2 logical array
%  bdIsLibrary(h) % returns logical scalar

%   Copyright 2014 The MathWorks, Inc.

bdtypes = get_param(bdnames,'BlockDiagramType');
isLibrary = strcmp(bdtypes,'library');
if ~ischar(bdnames)
    isLibrary = reshape(isLibrary,size(bdnames));
end

