MATLAB: Hey guys. Could use some help in obtaining output from the cell array.

cell arrayssprintf

CODE for i=1:1:20 sprintf('sometext %s moretext',(output{i})); end
My "output" is a cell array which contains data in the form: 'X123', 'X456', 'X789'. The code below gives me the following output: sometext X123 moretext sometext X456 moretext..
is it possible to get the output in the following way: sometext X123 X456 X789 moretext

Best Answer

Like this?
output = {'X123','X456','X789'}
MyStringOutput = ['sometext ' sprintf('%s ',output{:}) 'moretext']