function C = labelsback(C,LABELS,FORMAT)
% labelsback  [Not a public function] Replace #(...) with the corresponding string stored.
%
% Backend IRIS function.
% No help provided.

% -IRIS Toolbox.
% -Copyright (c) 2007-2012 Jaromir Benes.

replacefunc = @doreplace; %#ok<NASGU>
C = regexprep(C,'#\((\d+)\)','${replacefunc($1)}');

% Nested functions.

%**************************************************************************
    function s = doreplace(s)
        index = sscanf(s,'%g');
        s = LABELS{index};
        if ~isempty(FORMAT)
            s = sprintf(FORMAT,s);
        end
    end
% doreplace().

end
