Help for setting the formatSpec when reading hexadecimal
이전 댓글 표시
Hello, this is Matthew.
I'm trying to read a file that contains hexadecimal. This is the pattern. Or check the attached file, please.
00b7 17ff 5b3f 1700 c84b 1eff b398 1d00
a577 00ff 15b3 00ff 00b7 17ff 5b3f 1700
c84b 1eff b398 1d00 a577 00ff 15b3 00ff
00b7 17ff 5b3f 1700 6929 1eff b398 1dff
a577 00ff b690 00ff 00b7 1700 5b3f 1700
6929 1eff b398 1dff a577 00ff b690 00ff
So I wrote that
formatSpec = '%04x %04x %04x %04x %04x %04x %04x %04x\n';
fid = fopen(filename, 'r');
hex = fscanf(fid, formatSpec);
sizeHex = length(hex); % the length shows 0
How should I change the format spec to read the hexadecimal correctly?
-Regards, Matthew
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!