MATLAB Answers

error using fprintf function

13 views (last 30 days)
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

  0 Comments

Sign in to comment.

Accepted Answer

KSSV
KSSV on 20 Sep 2020
Edited: KSSV on 20 Sep 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 Comment

Joshua Mikhael Prieto
Joshua Mikhael Prieto on 20 Sep 2020
Thank you so much! That solves the problem. I'll always keep that in mind.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by