the funcion of "load" might have mistakes while loading the hexadecmial number. The hexadecimal numbers start with "0x".

1 view (last 30 days)
For example, "0xf8de" in a txt file after the command load('.txt')
the result of Matlab will be 63762, a decimal number.
BUT, the true transform result is 63710.
After a short test, I presume it transforms all "d" to "e" and make a wrong result finally.
I use the matlab version of R2017b.

Accepted Answer

Walter Roberson
Walter Roberson on 27 May 2022
https://www.mathworks.com/help/matlab/ref/load.html#btm0etn-1-filename
ASCII files must contain a rectangular table of numbers, with an equal number of elements in each row. The file delimiter (the character between elements in each row) can be a blank, comma, semicolon, or tab character. The file can contain MATLAB comments (lines that begin with a percent sign, %).
... notice no mention of support for hex numbers.
Historically, Mathworks has said that except for the support for additional delimiters, that the only text support is for values that can be generated by save -ascii
Have you experimented with readmatrix?

More Answers (0)

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!