Displaying more than four decimal places in Live Script

37 ビュー (過去 30 日間)
Colette Salemi
Colette Salemi 2016 年 10 月 6 日
コメント済み: Walter Roberson 2016 年 10 月 6 日
Hello! I'm a grad student seeking help in reformatting my Live Script editor. Live Script is great for my problem sets since it's so easy to clean up, and output is aligned with code. However I am hitting an issue while working with data that is yielding small estimates.
Basically, I can't get Live Script to report more than four decimal places. I'd like it to report eight decimal places. But the format long command isn't making a difference, and when I try to set the format to be long in preferences, nothing happens. Is this something unique to Live Script? Any advice would be greatly appreciated!

回答 (2 件)

Gareth Thomas
Gareth Thomas 2016 年 10 月 6 日
This has to do with they way you format your answer. Try this in the live script:
pi
format long
pi
  1 件のコメント
Colette Salemi
Colette Salemi 2016 年 10 月 6 日
Thanks for responding Gareth. When I ran that code in my live script, both answers for pi had four decimal places. :(

サインインしてコメントする。


Walter Roberson
Walter Roberson 2016 年 10 月 6 日
Please use
which format
to check to see if you have redefined format.
In my test in R2016b on OS-X, the "format" command does affect the Live Script output.
Which MATLAB release are you using, and which operating system?
  2 件のコメント
Colette Salemi
Colette Salemi 2016 年 10 月 6 日
Matlab R2016a for Mac. When I ran "which format" the output says:
built-in (/Applications/MATLAB_R2016a.app/toolbox/matlab/general/format)
Walter Roberson
Walter Roberson 2016 年 10 月 6 日
In R2016a for Mac, I observe that the output in LiveScript is always according to the Preferences, with the active "format" ignored. Change with Preferences -> Command Window -> Numeric Format . Apply, Save, and rerun the section in Live Script

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeReport Generator Creation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by