function selectionString = var2string(selectedData)

% Create an array of strings based on the selectedData array.

%   Copyright 2007-2015 The MathWorks, Inc.

selectionString = '';
% Use a tab separated list to ensure paste-ability to Variable Editor
if ~isempty(selectedData)
    
    if isnumeric(selectedData)
        selectionString = mat2str(selectedData);   
        selectionString = regexprep(selectionString,'^\[|\]$','');
        selectionString(selectionString == ' ') = sprintf('\t');
        selectionString(selectionString == ';') = sprintf('\n');
        
    else
        selectionString = cellstr(char(selectedData));
        selectionString = strjoin(selectionString,'\t');
    end
end