horzcat error while using ' '
显示 更早的评论
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?
采纳的回答
更多回答(1 个)
Andrei Bobrov
2013-5-28
names={'john'; 'ravi'; 'mary'; 'xiao'}
howdy=(10:10:40)';
result = strcat(names,{' '},num2str(howdy));
类别
在 帮助中心 和 File Exchange 中查找有关 Electromagnetics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!