How can I perform modulus operation (mod)?

조회 수: 5 (최근 30일)
Abdulatif Alabdulatif
Abdulatif Alabdulatif 2014년 8월 7일
댓글: Abdulatif Alabdulatif 2014년 8월 7일
Hi all,
I am trying to use build-in functions in Matlab to help me to convert my project from decimal system to binary system. It is include addition, subtraction, multiplication and division as well. Also I am looking for a function that can produce the result of (mod) operations (remainder)such as:
8 mod 10 = 8
-3 mod 10 = 7
But again, I want to perform this in binary system.
Can any one help me in this?
Thank you!

답변 (2개)

Andrei Bobrov
Andrei Bobrov 2014년 8월 7일
mod(8,10)
mod(-3,10)
  댓글 수: 1
Abdulatif Alabdulatif
Abdulatif Alabdulatif 2014년 8월 7일
I am looking for a function that is work in binary system which is consists of (0)s and (1)s.

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


Iain
Iain 2014년 8월 7일
All the numbers in matlab are represented as binary numbers. Results are displayed as strings.
- 1 has 11 different built in representations, which in hex are:
01, 0001, 00000001, 0000000000000001 (logical, signed & unsigned 8, 16, 32, & 64 bit integers) 000000000000F03F (double) and 0000083F (single).
What do you really want to do?
  댓글 수: 1
Abdulatif Alabdulatif
Abdulatif Alabdulatif 2014년 8월 7일
Hi Lain,
I am doing operations for example like this:
(2+3)mod 28 && (8+22)mod 28
I want to perform these operations as binary operations and show the results in binary results.

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

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by