The MATLAB function DEC2HEX returns the hexadecimal representation of a decimal integer as a string. If this value is passed as an argument to your MEX routine, it will be passed as a string and not as a hexadecimal number. In the C-MEX routine, you will need to parse the string and write your own routine to convert this string into a hexadecimal number.
Similarly, if you want to pass a hexadecimal number from C to MATLAB, you will have to pass the string representation of the hexadecimal number to MATLAB. You can then use HEX2DEC function to convert the string into a decimal number.
Best Answer