function decval=he2de(hexval, flag) if flag==0 decval = hex2dec(hexval); else decval = hex2dec(hexval); decval = decval- 2^(4*length(hexval)); end