horzcat error while using ' '
1 回表示 (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
採用された回答
Iman Ansari
2013 年 5 月 28 日
names=['john'; 'ravi'; 'mary'; 'xiao']
howdy=['10'; '20'; '30' ;'40']
result=[names repmat(' ',4,1) howdy]
0 件のコメント
その他の回答 (1 件)
Andrei Bobrov
2013 年 5 月 28 日
names={'john'; 'ravi'; 'mary'; 'xiao'}
howdy=(10:10:40)';
result = strcat(names,{' '},num2str(howdy));
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!