%% Convert Hexadecimal Number to Octal
% Convert a hexadecimal (base-16) value to an octal (base-8) value. There are two ways to convert hexadecimal values.
% Starting in R2019b, you can specify numbers as binary or hexadecimal literals, using the 0b and 0x prefixes. MATLAB® interprets and stores these literals as ordinary numbers, which the dec2base function can convert to character arrays representing values in the specified base.
% Write a number as a hexadecimal literal. It is stored as an unsigned integer with an appropriate size.

b = 0xFF

%
% Convert it to an octal character vector using dec2base.

base8str = dec2base(b,8)

%
% As an alternative, in any version of MATLAB, you can represent the base-12 number by a character vector, and convert it using the hex2dec and dec2base functions together. When using hex2dec do not specify the 0x prefix.

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

%

base8str = dec2base(D,8)

% Copyright 2019 The MathWorks, Inc.