Invalid file identifier. Use fopen to generate a valid file identifier.
6 次查看(过去 30 天)
显示 更早的评论
I'm trying to open a file in this function, for the purpose of using it in another function. However, when I call on it, it gives me the error in fread, as stated in the title. I believe this is a result of fopen failing to open the file. However, I'm not certain how to fix it. Any help is appreciated. Thank you.
fileID = fopen(filename, 'rt');
[A,count]= fread(fileID,[2 inf], 'uint8');
回答(1 个)
per isakson
2019-11-19
Try
filespec = fullfile( "/Users/kira/desktop/PHYS4115Tables/'att'", filename );
fileID = fopen(filespec, 'rt');
assert(fileID>=3,msg)
And show us the displayed message.
What's 'att' ? The name of a subfolder?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Low-Level File I/O 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!