Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

dec2bin

Convert decimal number to character vector representing binary number

Syntax

str = dec2bin(d)
str = dec2bin(d,n)

Description

str = dec2bin(d) returns the binary representation of d as a character vector. d must be a nonnegative integer. If d is greater than the value returned by flintmax, then dec2bin might not return an exact representation of d.

str = dec2bin(d,n) produces a binary representation with at least n bits.

The output of dec2bin is independent of the endian settings of the computer you are using.

Examples

Decimal 23 converts to binary 010111:

dec2bin(23)
ans =
    10111
Was this topic helpful?