horzcat error while using ' '
Show older comments
names=['john'; 'ravi'; 'mary'; 'xiao']
howdy=char('10', '20', '30' ,'40')
result=[howdy, ' ', names] % ' ' in order to seperate columns
I wanna create result as
john 10
ravi 20
mary 30
xiao 40
but result=[howdy, ' ', names] gives horzcat error. How can I fix this?
Accepted Answer
More Answers (1)
Andrei Bobrov
on 28 May 2013
names={'john'; 'ravi'; 'mary'; 'xiao'}
howdy=(10:10:40)';
result = strcat(names,{' '},num2str(howdy));
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!