fread works on linux system but not windows?
2 views (last 30 days)
Show older comments
Hi,
I'm trying to open an image file using This code:
format = 'uint16'
file = image_file_name;
Z = fread(fopen(file),info.samples*info.lines*info.bands,format,0,'ieee-le');
where info.samples*info.lines*info.bands is the image size.
This code works perfectly fine on a linux server. On the Windows Server 2012 box every time I load, I only get the max value for the format (e.g., 65535 for 'uint16'). I suspect this has something to do with little-endian vs. big-endian or perhaps encoding but I've played with these values to no avail.
For the unix box when I run the code on this image file:
[filename, permission, machineformat, encoding] = fopen(fid);
I get: permission = 'r', machineformat = 'ieee-le.l64', and encoding = 'UTF-8'
When I run the same code on the same image on the Windows box I get:
I get: permission = 'rb', machineformat = 'ieee-le', and encoding = 'windows-1252'
Any thoughts on what I need to do here?
Thanks, Mike
1 Comment
Answers (0)
See Also
Categories
Find more on Search Path in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!