What did they change to 'fread' on 2020a?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Y. Li
el 19 de Mayo de 2020
Respondida: Paul Dankoski
el 5 de Feb. de 2021
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/294594/image.png)
The left is 2020a, and the right is 2019a.
As the picture says, it takes significant longer time to execute and sometime it returns different resutls.
0 comentarios
Respuesta aceptada
Walter Roberson
el 19 de Mayo de 2020
File I/O functions, such as fscanf and fprintf, use automatic character set detection and UTF-8 encoding by default
Behavior change
As of R2020a, character-oriented file I/O functions such as fscanf, fgets, and fgetl trigger automatic character set detection when reading a file that was opened using fopen without a specified encoding.
Similarly, fprintf defaults to using UTF-8 encoding when writing a file that was opened using fopen without a specified encoding
You probably have a large file, and fread() is having to scan through a lot of the file to try to figure out what the character encoding is.
I would suggest that better code for you would be
beg4c = fread(fid, [1 4], 'uint8=>char');
Más respuestas (1)
Paul Dankoski
el 5 de Feb. de 2021
According to release notes, 2020a, Update 4 is also an option.
0 comentarios
Ver también
Categorías
Más información sobre Low-Level File I/O en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!