Hello! I have the number 40.201109, I need to work with numbers 109, and then with 110 and at the end of 40. Help me how to separate them

댓글 수: 6

Rik
Rik 2019년 11월 19일
Also, do you have this number in text or in numeric format?
Walter Roberson
Walter Roberson 2019년 11월 19일
But 201 is not to be used?
Lev Mihailov
Lev Mihailov 2019년 11월 19일
40.20 ''110'' 9.
Double Values.
201 will not be used, but they are needed for other purposes.
40.201109 from this I should get 55.201992
Walter Roberson
Walter Roberson 2019년 11월 19일
You do not understand how you get that number.
If you have a number of the form AB.cdefgh then how should the output be formed?
Here is an example of some mathematical operations that I can do with a pen, I need to automate it all
40.201109 a=40 b=110 c=109
x1=c+b*10^-5;
x2=x1+a-b;
x3=x2+c-x1^2
x4=......
x124=55.201992
there are many operations, but if I can get a, b, c, I can fully calculate everything

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2019년 11월 19일

0 개 추천

x = 40.201109;
xs = sprintf('%.6f', x);
a = str2double(xs(1:2));
b = str2double(xs(end-3:end-1));
c = str2double(xs(end-2:end));
This presumes there are exactly 6 significant decimal places. It is not generally possible to figure out how many significant decimal places a binary floating point number has -- for example 40.201109 is stored internally as 40.201109000000002424712874926626682281494140625 exactly.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

태그

질문:

2019년 11월 19일

답변:

2019년 11월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by