error using fprintf function

53 次查看(过去 30 天)
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

采纳的回答

KSSV
KSSV 2020-9-20
编辑:KSSV 2020-9-20
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 个评论
Joshua Mikhael Prieto
Thank you so much! That solves the problem. I'll always keep that in mind.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by