Avoid +0 when using fprintf %+d
古いコメントを表示
Consider the code
names={'aba','cda','efa','fea','pod'};
numbers=randi([-1 1],5,4);
for i=1:5
fprintf('|%s|%+d|%+d|%+d|%+d|\n',names{i},numbers(i,:))
end
whose output is similar to
|aba|+0|+1|+1|+1|
|cda|-1|+1|-1|+1|
|efa|+1|+0|-1|-1|
|fea|+1|+0|-1|+1|
|pod|+1|-1|-1|-1|
Is there a way to remove the plus in front of the 0s, or to not print + when the number is 0?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Genomics and Next Generation Sequencing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!