Here's another approach that takes advantage of Matlab's strjoin
function. With strjoin
it's easy to customize the delimiter between values.
x = [1, 2, 3];
fprintf('Answer: (%s)\n', strjoin(cellstr(num2str(x(:))),', '));
This results in: Answer: (1, 2, 3)