フィルターのクリア

How do I get Matlab to stop formating my numbers?

3 ビュー (過去 30 日間)
John Callahan
John Callahan 2012 年 7 月 17 日
Hello all,
This question will probably seem pretty obvious but I can't seem to find an answer. I would like matlab to stop changing numbers such as 12000000 into 1.20e+7. I am not quite sure how to do this.
This is both for asthetic reasons and for code reasons. I have code that compares two strings, one being read from a vector and the other being read from a text field in a gui. The one being read from the text field is being read as '1.53e+06' and the one being read from the vector is being read as '1532231.00'. strcmp doesn't equate these two as equal.
Any help is much appreciated :)
Regards,
John.

採用された回答

Thomas
Thomas 2012 年 7 月 17 日
You can set the default format through the GUI
on Windows: File > Preferences > Command Window > Numeric format
On MAC: MATLAB > Preferences > Command Window > Numeric format
  1 件のコメント
John Callahan
John Callahan 2012 年 7 月 17 日
Thank you very much. That's exactly what I needed.

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

その他の回答 (1 件)

Rolfe Dlugy-Hegwer
Rolfe Dlugy-Hegwer 2012 年 7 月 17 日
編集済み: Rolfe Dlugy-Hegwer 2012 年 7 月 17 日
To set the display format to long fixed decimal, enter:
>> format long
To see the results, enter:
>> pi
ans =
3.141592653589793
To see the current format, enter:
>> get(0,'format')
  1 件のコメント
John Callahan
John Callahan 2012 年 7 月 17 日
Thank you that helped. Is there a way to set the default format to long?

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by