i have array like this a = 50 60 70 80 and want to make each entity comma seperated i.e 50,70,80,90 how i can do this?
2 ビュー (過去 30 日間)
古いコメントを表示
it can be done by concetnation method?
1 件のコメント
Jan
2013 年 7 月 23 日
Neither the input nor the output is defined exactly. I guess that the input is a numerical vector like:
a = [50, 60, 70, 80]
and the output should be a string:
s = '50, 60, 70, 80'
I assume, that the omitted '60' and the added '90' is a typo only.
Please be as exact as possible, when you ask a question in the forum. Guessing the details means usually a waste of your and out time. Thanks.
採用された回答
その他の回答 (1 件)
Jan
2013 年 7 月 23 日
a = [50, 60, 70, 80]
s = sprintf('%d, ', a);
s(end-1:end) = []; % Remove the trailing ', '
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!