How can I align text to be left-justified using fprintf?

32 vues (au cours des 30 derniers jours)
Tyler
Tyler le 2 Avr 2014
Commenté : Tyler le 2 Avr 2014
While using fprintf I would get text that aligns at the end of the word by default. I need it to be able to align at the beginning or left hand side of the word. Thanks.

Réponses (1)

dpb
dpb le 2 Avr 2014
>> fprintf('%10s\n','abcdef')
abcdef
>> fprintf('%-10s\n','abcdef')
abcdef
>>
doc fprintf
read up on format string in the links thereto...
  1 commentaire
Tyler
Tyler le 2 Avr 2014
Thank you very much :) Fixed my issue!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by