function s = cellstr2str(c,sep)
% function s = cellstr2str(c,sep)
% Takes a cell array of strings, c, and converts it into a single horizontal
% string with one space between cell values.
% Handy for passing a cell array of variable names (e.g. generated by the who function)
% into an eval function.
%
% 20080826 GMW
% 20150617 GMW added optional input "sep" to specify a different separator (e.g. "-") instead of
%              white space.

if nargin<2
    sep = ' ';
end

l = length(c);
s=[];
for i=1:l
    s = [s c{i} sep];
end

