Is there a function to tell if Matlab is using little-endian or big-endian on current computer?

조회 수: 35 (최근 30일)
Is there a function to tell if Matlab is using little-endian or big-endian on current computer?

채택된 답변

Steven Lord
Steven Lord 2024년 12월 17일 5:27
See the third output from the computer function.
[str, maxsize, endianness] = computer
str = 'GLNXA64'
maxsize = 2.8147e+14
endianness = 'L'

추가 답변 (1개)

Matt J
Matt J 2024년 12월 17일 4:53
편집: Matt J 2024년 12월 17일 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

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by