dec2bin(d) problem converting

hello, i want to convert a decimal number to a binary number so i use thi comand dec2bin(23) normelly the answer should be lik this : ans = 10111 instead i get that :
Columns 65508 through 65520
0 0 0 0 0 0 0 0 0 0 0 0 0
Columns 65521 through 65533
0 0 0 0 0 0 0 0 0 0 0 0 0
Columns 65534 through 65535
will you please tell me what seems to be the problem, and thanks in advance :)

댓글 수: 5

the cyclist
the cyclist 2013년 10월 5일
Can you post a snippet of code that exhibits the problem?
Does dec2bin(23) itself give output like that?
dpb
dpb 2013년 10월 5일
편집: dpb 2013년 10월 5일
Looks like you've made a typo on input in all likelihood...and given dec2bin an array of size int16 of zeros by mistake.
As cyclist says, would have to see the precise code that produced the output and then back up to what defined the argument. I suspect if you prepare that input for posting you'll likely find the cause on your own while doing so...
Or, of course, it's possible you had a typo that ended up redefining dec2bin as an array and your output is just that.
which dec2bin
whos dec2bin
may be illuminating in this case...
KHADIJA
KHADIJA 2013년 10월 6일
hello, thank you for answering me so quickly, you were right i had the wrong code for the function dec2bin so i had to replace it by a new one. thank you so much again :)
Jan
Jan 2013년 10월 6일
@KHADIJA: Please post this as an answer and accept it, such that the readers can see, that the problem is solved.
KHADIJA
KHADIJA 2013년 10월 6일
@Jan Simon: i don t know how to do it,will you show me how please

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

답변 (1개)

Walter Roberson
Walter Roberson 2013년 10월 6일

0 개 추천

KHADIJA wrote,
hello, thank you for answering me so quickly, you were right i had the wrong code for the function dec2bin so i had to replace it by a new one. thank you so much again :)

카테고리

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

질문:

2013년 10월 5일

답변:

2013년 10월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by