From the number to make a fraction?

조회 수: 4 (최근 30일)
Lev Mihailov
Lev Mihailov 2019년 7월 30일
댓글: Lev Mihailov 2019년 7월 30일
Hello! I have the number 3408289, I need to make 34,08289 out of it, how can I do this in the matlab?
And then the task is to take that number away.
x=[3408289 3408354 3408678];
y=[14,02 14,19 14,15];
z=x-y;
  댓글 수: 2
Stephen23
Stephen23 2019년 7월 30일
편집: Stephen23 2019년 7월 30일
"I have the number 3408289, I need to make 34,08289"
What does this mean exactly? Are you trying to print a formatted number somewhere?
"From the number to make a fraction?"
You do not mention fractions in the body of your question.
Lev Mihailov
Lev Mihailov 2019년 7월 30일
the system gives such answers without a fractional part.my answers are 3408289 wrong so you need to add a comma

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

답변 (1개)

madhan ravi
madhan ravi 2019년 7월 30일
X = zeros(size(y));
X(1:2:end) = fix(x / 1e5);
X(2:2:end) = rem(x , 1e5);
z = X-y
  댓글 수: 2
Lev Mihailov
Lev Mihailov 2019년 7월 30일
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in Untitled (line 16)
X(1:2:end) = fix(x / 1e5);
gives this error
madhan ravi
madhan ravi 2019년 7월 30일
>> x=[3408289 3408354 3408678];
y=[14,02 14,19 14,15];
>> X = zeros(size(y));
X(1:2:end) = fix(x / 1e5);
X(2:2:end) = rem(x , 1e5);
z = X-y
z =
20 8287 20 8335 20 8663
>>

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by