"I need an efficient way to do it when there are many entries in A."
This is probably about the most efficient way:
A = 1:5;
str = sprintf(',%d',A);
str = str(2:end);
Timing comparisons for 1e4 iterations:
Elapsed time is 0.539053 seconds.
Elapsed time is 2.54425 seconds.