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.

hexToBinaryVector

Convert hexadecimal value to binary vector

Syntax

  • hexToBinaryVector(hexNumber)
    example
  • hexToBinaryVector(hexNumber,numberOfBits)
    example
  • hexToBinaryVector(hexNumber,numberOfBits,bitOrder)
    example

Description

example

hexToBinaryVector(hexNumber) converts hexadecimal numbers to a binary vector.

example

hexToBinaryVector(hexNumber,numberOfBits) converts hexadecimal numbers to a binary vector with the specified number of bits.

example

hexToBinaryVector(hexNumber,numberOfBits,bitOrder) converts hexadecimal numbers to a binary vector with the specified number of bits in the specified bit ordering.

Examples

collapse all

hexToBinaryVector('A1')

ans=

     1     0     1     0     0     0     0     1
hexToBinaryVector('0xA')
ans=

     1     0     1     0
hexToBinaryVector(['A1'; 'B1'])

ans=

     1     0     1     0     0     0     0     1
     1     0     1     1     0     0     0     1
hexToBinaryVector('A1',12, 'MSBFirst')
ans=

     0     0     0     0     1     0     1     0     0     0     0     1
hexToBinaryVector({'A1';'B1'},8)
ans=

     1     0     1     0     0     0     0     1
     1     0     1     1     0     0     0     1
hexToBinaryVector('A1', [], 'LSBFirst')
ans=

     1     0     0     0     0     1     0     1

Related Examples

Input Arguments

collapse all

Hexadecimal number to convert to a binary vector specified as a character or an array.

This is an optional argument. If you do not specify the number of bits, the number is represented using the minimum number of bits needed.

Bit order for the binary vector representation, specified as a character vector. Accepted values are:

  • 'MSBFirst' — The first element of the binary vector is the most significant bit.

  • 'LSBFirst' — The first element of the binary vector is the least significant bit.

Introduced in R2012b

Was this topic helpful?