MATLAB: How to convert decimal value to a binary string, and then convert them to a vector

MATLAB

I want to convert decimal value to a binary string, but I am not able to convert the binary string to vector.
How can I do it?

Best Answer

  • MATLAB function "decimalToBinaryVector" will help you to convert decimal to binary. Please refer to the following documentation for more information:
    This function will only help, if the you have Data Acquisition Toolbox.
    If you do not have this toolbox, you can convert your binary string to vector by following the below steps:
    >> strTemp = '11010'
    >> ans = num2str(strTemp)-'0';