%% Swap Byte Ordering of Scalar
% Swap the byte ordering for a scalar 32-bit value. Use hexadecimal representation to show the conversion from little endian to big endian.

X = uint32(hex2dec('4D3C2B1A'));
Y = dec2hex(swapbytes(X))

% Starting in R2019b, you can also write a hexadecimal value as a literal using the 0x or 0X prefix (for more information, see Specify Hexadecimal and Binary Values Using Literals or Strings). Specify the number X as a hexadecimal literal. Swap the byte ordering.

X = 0x4D3C2B1A;
Y = dec2hex(swapbytes(X))

%
% Copyright 2019 The MathWorks, Inc.