MATLAB: Cannot get binaryVectorToHex() to work on result of deconv() in gf(2)

binary vector to hexadecimalgalois fields

I can get hex from binary char or numeric strings OK eg. binaryVectorToHex([1 0 0 1])= 9 or binaryVectorToHex(str2num('1 0 0 1'))=9
But not from the remainder result of a Galois field deconv() polynomial division. The gf functions give the expected results, the problem is applying binaryVectorToHex() to the remainder of the deconv() to get back to hex again. This is my code:
%TestMultGF.m
Hex1='57'; %0x57, polynomial = x^6+x^4+x^2+x^1+x^0
Hex2='83'; %0x83, = x^7+x^1+x^0
Bin1=hexToBinaryVector(Hex1) %interprets as hex, creates char array
Bin2=hexToBinaryVector(Hex2)
Bin1_gf=gf(Bin1,1); %create gf(2) Galois fields
Bin2_gf=gf(Bin2,1);
Mult=conv(B1_gf,B2_gf) %convolve (multiply) in gf(2)
%require remainder after mod (x^8+x^4+x^3+x^1+x^0)
DB=[1 0 0 0 1 1 0 1 1];
DB_gf=gf(DB,1); %create a gf(2) for the divisor
[q, r]=deconv(Mult,DB_gf); %deconvolve in GF
%q = quotient, r = remainder
%rHex=binaryVectorToHex(r);
if true
% code
end
rHex=binaryVectorToHex(r);
I keep getting errors like: Error using TestMultGF (line 23) Invalid binary vector input. Use a 1 X N numeric vector consisting of 0's and 1's.
The gf function output is a char string but I cannot convert this to the numeric vector required with anything like str2num().
Please can somebody help me with this? Thank you, Chris

Best Answer