b=fprintf how to

2 ビュー (過去 30 日間)
Opariuc Andrei
Opariuc Andrei 2020 年 10 月 30 日
コメント済み: Star Strider 2020 年 10 月 30 日
a=2.65987 ,after using the fprintf('%0.5g\n',a) i get the value i want being 2.6599 i tried doing b=fprintf('%0.5g\n',a) (i wanted to keep a better track of my work ) but it modified my result into 7 ,is there a way of keeping the b=fprintf('%0.5g\n',a) and still keeping the initial value 2.6599 ?


Star Strider
Star Strider 2020 年 10 月 30 日
If you want to store the result as ‘b’, use the related function sprintf:
It is a separate line of code, however you get to retain the result.
  2 件のコメント
Star Strider
Star Strider 2020 年 10 月 30 日
As always, my pleasure!
In your original fprintf call, ‘b’ was the number of bytes fprintf wrote. See Get Number of Bytes Written to File for an detailed explanation.


その他の回答 (0 件)


Help Center および File ExchangeEnvironment and Settings についてさらに検索


Community Treasure Hunt

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

Start Hunting!

Translated by