Is there a function to tell if Matlab is using little-endian or big-endian on current computer?
35 views (last 30 days)
Show older comments
raym
on 17 Dec 2024 at 4:36
Answered: Steven Lord
on 17 Dec 2024 at 5:27
Is there a function to tell if Matlab is using little-endian or big-endian on current computer?
0 Comments
Accepted Answer
More Answers (1)
Matt J
on 17 Dec 2024 at 4:53
Edited: Matt J
on 17 Dec 2024 at 4:58
function endianType = checkEndian()
% Typecast uint16(1) to uint8 to examine the byte order
byteValue = typecast(uint16(1), 'uint8');
% Check the first byte to determine endianness
if byteValue(1) == 1
endianType = 'little-endian';
else
endianType = 'big-endian';
end
end
0 Comments
See Also
Categories
Find more on String Parsing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!