%% Swap Byte Ordering of Vector
% Swap the byte ordering for each element of a 1-by-4 vector.

format short
X = uint16([0 1 128 65535])
Y = swapbytes(X)

% Examine the output in hexadecimal notation to show the endian conversion.

format hex
X
Y

%
% Copyright 2019 The MathWorks, Inc.