function [UNIQUE] = is_tag_unique (GOBJ, TAG)
%
% [UNIQUE] = is_tag_unique (GOBJ, TAG)
%
% Compares the input TAG with each GOBJ.objects{}.tag and GOBJ.tags{}. 
% If a match is NOT found UNIQUE is set true, if a match IS found, 
% UNIQUE is set false.

% First check all tags{} (which might be sufficient)
for i=1:1:length(GOBJ.tags)
    if (isequal(GOBJ.tags{i}, TAG))
       %disp ("Input TAG located in GOBJ.tags{"+i+"}:");
       UNIQUE = false;
       return;
    end
end

% Next check all objects{}.tag (which may be superfluous)
for i=1:1:length(GOBJ.objects)
    if (isequal(GOBJ.objects{i}.tag, TAG))
       %disp ("Input TAG located in GOBJ.objects{"+i+"}:");
       %disp (GOBJ.objects{i});
       UNIQUE = false;
       return;
    end
end

UNIQUE = true;
disp ("Input TAG: "+TAG+" not found in GOBJ");

return;
end
