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

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

 Accepted Answer

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

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!