Avoid +0 when using fprintf %+d
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Genomics and Next Generation Sequencing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!