error using fprintf function

53 visualizzazioni (ultimi 30 giorni)
Joshua Mikhael Prieto
Joshua Mikhael Prieto il 20 Set 2020
A = 1000000000;
B = A / 512;
fprintf(B);
Error using fprintf
No format character vector.
Error in MachineProblem5 (line 4)
fprintf(B);
can someone please help me with this error, fprinf funtion suddenly goes into error. Same goes with my previous works, it began to display fprintf error

Risposta accettata

KSSV
KSSV il 20 Set 2020
Modificato: KSSV il 20 Set 2020
You have to specify a format specifier.
A = 1000000000;
B = A / 512;
fprintf('%f\n',B); % %f is for floating point number, \n is for next line
  1 Commento
Joshua Mikhael Prieto
Joshua Mikhael Prieto il 20 Set 2020
Thank you so much! That solves the problem. I'll always keep that in mind.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by