%% Convert Text Representing Hexadecimal Value
% Convert a character vector that represents a hexadecimal value to a decimal number.

hexStr = '3FF';
D = hex2dec(hexStr)

%
% Starting in R2019b, you can write values in hexadecimal format directly without using hex2dec. Use the 0x prefix and do not use quotation marks. MATLAB® stores the value as an integer, not as text.

D = 0x3FF

% Copyright 2019 The MathWorks, Inc.