hexadecimal value with zeros but without spaces.
6 visualizzazioni (ultimi 30 giorni)
Maria Imdad il 8 Dic 2020
I have an algorithm which is generating outputs in hexadeciaml formats. Its a loop with with different hexadecimal values after every iteration. My ultimate purpose is to ocnvert these hexa deciamal values into binaries and combine all those values as one binary string. Now the problem is that I get "ee 06 da 7b " hexa decimal values like this, and in order to its conversionin binary I have to remove these spaces in between but, as I try to remove the spaces, leading zeros are also removed. That part which is performing these conversions and some output is also added as an image. I will be greatful if you can help, as i ahve already tried so many methods available on internet.
% to get hexa decimal value and save it to variable str
str = sprintf(' %2x', w(i, :));
% to remove spaces in between
%hex to binary conversion
str(all(str == ' ', 2), :) = ;
% str = strrep(str, ' ', '')
% str = strtrim( str);