The error indicates that fopen returned an invalid file ID.
Try this:
[fid,msg] = fopen(filename)
if fid < 0
error(msg)
end
More than likely, the file is not in the current working directory. try
That will show you if the file is being found, if it doesn't give a result, you'll need to provide the full path to the file.
HTH
2 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/718055-problem-with-the-function-fread#comment_1265835
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/718055-problem-with-the-function-fread#comment_1265835
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/718055-problem-with-the-function-fread#comment_1265900
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/718055-problem-with-the-function-fread#comment_1265900
Sign in to comment.