I have some input numbers, for example, [128 129 139 255 256].
They are written to a file with format 'char' and then the file is read with same format.
But the output is different ([26 129 26 255 26])
What was wrong?
The machine is Windows 10 and Matlab version R2019b.
The simple test code:
xInput = [128 129 139 255 256]';filename = 'test.bin';formt = 'char';fid = fopen(filename, 'w');fwrite(fid, xInput, formt);fclose(fid);fid = fopen(filename, 'r');xOutput = fread(fid, inf, formt);fclose(fid);[xInput xOutput]
Best Answer