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!