how to join 3 strings into single string?
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
更多回答(1 个)
Nicolaie Popescu-Bodorin
2017-4-2
res = strCell{1};
for k=2:length(strCell),
res=[res '-' strCell{k}];
end;
disp(res);
1 个评论
Stephen23
2017-4-2
This expands the output res on each iteration, which is not efficient:
See my answer for a simpler and more efficient solution that does not use a loop.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!