MATLAB: How to convert hex array to decimal array hex2dec hello i want to convert hex number to dec for exmaple : a=hex2dec('d2') now i want an array of hex numbers for exmaple :[ d1 d2 d4 cf ] how can i convert this array ? Best Answer One char vector, fixed length hexadecimal, no spaces:>> sscanf('d1d2d4cf','%2x')ans = 209 210 212 207One char vector, any length, space characters:>> sscanf('d1 d2 d4 cf','%x')ans = 209 210 212 207From one cell array, any length char vectors:>> C = {'1','d2','d4','cf'};>> sscanf(sprintf('%s\v',C{:}),'%x\v')ans = 1 210 212 207 Related SolutionsMATLAB: How to convert char into string >> str = 'd879c14e5b1fa7a413aa46bbbc2b8710';>> dec2bin(sscanf(str,'%2x'))ans =11011000011110011100000101001110010110110001111110100111101001000001001110101010010001101011101110111100001010111000011100010000 MATLAB: Convert decimal to hex in a table Would this suffice?>> dec2hex([13 232 4 43])ans =0DE8042B Related QuestionA function that converts a binary string to its corresponding char values.Adding Hexadecimal numbersHow to add leading zeros to a number in Hex formatHow to convert an array of hex values to a numCovert 128 binary string into hex decimal
Best Answer