Filter löschen
Filter löschen

Combine fprintf and disp

1 Ansicht (letzte 30 Tage)
Niklas Reinshagen
Niklas Reinshagen am 19 Jun. 2020
Kommentiert: Ameer Hamza am 19 Jun. 2020
Hey all together!
I'm writing a code but be a littler confused because basicly I have to combine fprintf and disp...
fprintf('\nSite name: disp(name(1:4))) \n')
So I'm using a fprintf to print this line of Strings: Site Name: and after this, there shoul'd be written the first 4 letters from my File, i insert this function. Is ist somehow possible to write it this way? I allways get an error... :-(

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 19 Jun. 2020
disp() is not needed here.
fprintf('\nSite name: %s \n', name(1:4))
See the documentation of fprintf for detail of the formating string.
  2 Kommentare
Niklas Reinshagen
Niklas Reinshagen am 19 Jun. 2020
nice! You saved my day for the second time today :-)
Ameer Hamza
Ameer Hamza am 19 Jun. 2020
I am glad to be of help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by