Azzera filtri
Azzera filtri

Fprintf question and application.

2 visualizzazioni (ultimi 30 giorni)
fprintf( '%7sVIII\n', 'Henry' )
fprintf( '%1sVIII\n', 'Henry' )
I can't understand the difference between the two. They have the same output. How does the field size value effect the fprintf?

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 14 Lug 2015
Write this, you will understand
fprintf( '%50sVIII\n', 'Henry' )
  3 Commenti
Azzi Abdelmalek
Azzi Abdelmalek il 15 Lug 2015
Modificato: Azzi Abdelmalek il 15 Lug 2015
%50s, will be replaced by a string 'henry' with length equal to 50 characters, that's why you 45 blanks and the five character of 'Henry'.
VIII? because you add it!
Hussain Hayat
Hussain Hayat il 15 Lug 2015
I cant figure out how this function works completely, I did check MATLAB help, hoping that this example can help clear it up.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by