Documentation

num2bin

Convert number to binary representation using quantizer object

Syntax

y = num2bin(q,x)

Description

y = num2bin(q,x) converts numeric array x into binary character vectors returned in y. When x is a cell array, each numeric element of x is converted to binary. If x is a structure, each numeric field of x is converted to binary.

num2bin and bin2num are inverses of one another, differing in that num2bin returns the binary representations in a column.

Examples

x = magic(3)/9;
q = quantizer([4,3]);
y = num2bin(q,x)

Warning: 1 overflow.

y =

0111
0010
0011
0000
0100
0111
0101
0110
0001

Introduced before R2006a

Was this topic helpful?