% DUPLICATE Duplicate the cursorbar to an identical one.
%
% Duplicate created an identical Cursorbar to the desired by directly
% calling the Cursorbar constructor. Cursorbar has no copy method and does
% not subclass matlab.mixin.Copyable, since the copying procedure in handle
% graphics may result in unexpected behavior. Instead, it uses duplicate as
% a hard-copy method.
%
% See also: graphics.Cursorbar.drawCrossbar, graphics.Cursorbar.
%
% Thanks to <a href="http://www.mathworks.com/matlabcentral/profile/authors/3354683-yaroslav">Yaroslav Don</a> for his assistance in updating cursorbar for
% MATLAB Graphics and for his contribution of new functionality.
% Copyright 2015-2016 The MathWorks, Inc.
% duplicate depending on situation:
if isempty(hThis)
% empty Cursorbar: return empty array
hThat = graphics.Cursorbar.empty(size(hThis));
elseif ~isscalar(hThis)
% an array of Cursorbars: recursively duplicate each