Convert array of digits to a binary number Convert array of digits to a binary number arrays arrays

Convert array of digits to a binary number


Maybe this is what you want:

char(a+'0')

Example:

>> a=[1 0 1 0 1 0]a =     1     0     1     0     1     0>> char(a+'0')ans =101010

This works by converting each number to its ASCII code (+'0') and then converting the vector of resulting numbers to a string (char()).


You can convert it to a string:

sprintf('%d',a)

which I think is the only alternative to an array of logicals.