Matlab rounding my values without me wanting it
4 ビュー (過去 30 日間)
古いコメントを表示
Hello, this basically frustrates me a bit, - if I have:
Price = 20074.5;
And I present it in my table like this:
disp(table(Price,'VariableNames',{'answer'}));
answer
_____
20075
I dont get decimals? Anyone know a way around this? I hope there can be some kind of solution without format long/short because I don't want to touch other things
- Best
0 件のコメント
回答 (1 件)
Walter Roberson
2019 年 8 月 26 日
You get that when format short or format short g or format rat or format hex is in effect.
To work around this without changing your active format, you will need to edit the function getFloatFormats() at roughly line 427 of file toolbox/matlab/datatypes/@tabular/disp.m
6 件のコメント
Walter Roberson
2019 年 8 月 26 日
function disptable(Table)
old_format = matlab.internal.display.format;
format long
disp(Table)
format(old_format)
end
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!