Concatenate cell array into one string

31 views (last 30 days)
Artyom on 29 Aug 2014
Answered: Honglei Chen on 29 Aug 2014
Hi. I want to concatenate a cell array {'a', 'b', 5, []} in a string 'a b 5'. How can I do this?

Accepted Answer

Honglei Chen
Honglei Chen on 29 Aug 2014
x = {'a','b',5,[]}
x = cellfun(@num2str,x,'UniformOutput',false)
sprintf('%s ',x{:})

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by