How to apply change in variable format via preferences?

4 ビュー (過去 30 日間)
Paula Banca
Paula Banca 2016 年 12 月 8 日
コメント済み: Paula Banca 2016 年 12 月 8 日
I am trying to change the format of a variable in my table to a long g format. I changed it via Matlab preferences > Variables. However, after clicking apply and OK nothing happens (still have the exp format). Why is this change not being applied? Is there any other way to change the format of my variable? Thanks!
  2 件のコメント
Jan
Jan 2016 年 12 月 8 日
Please explain, what a "table" is here: a table object, a uitable, a printed table in the command window, an Excel table?
Paula Banca
Paula Banca 2016 年 12 月 8 日
Apologies for not being clear. I imported my Excel data into Matlab using the function 'readtable'. So, when I say table I mean the output of this function. I would like to change the format of two variables of this table to long g. Thank you!

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

採用された回答

Steven Lord
Steven Lord 2016 年 12 月 8 日
The preferences in the Variables section of the preferences for MATLAB in the Preferences window control the behavior of the Variable Editor. They don't control the formatting of variables when displayed in the Command Window. For that you want to use the preferences in the Command Window section of the preferences for MATLAB in the Preferences window (the first item listed in the table on that page) or use the format function.
>> format short
>> t = table(pi)
t =
Var1
______
3.1416
>> format long
>> t
t =
Var1
________________
3.14159265358979

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by