File in use error, fclose not enough?
25 次查看(过去 30 天)
显示 更早的评论
Hello,
I have the following problem. My plan was to write a txt file in matlab. This file contains the data to open in another program for controlling a robot.
fid = fopen('filename','wt');
for (i=1:amount)
fprintf(fid, '%s\n',my_cell{i});
end
fclose(fid)
When I run the file I want to be able to open the file in that other program. But it says 'file in use'. Is there a way to avoid this? Apparently fclose(fid) is not enough..
Thanks!
1 个评论
Walter Roberson
2014-5-13
Is it possible that you had fopen()'d it without fclose() in a run that error'd? If so then it would still be open. Have you tried exiting MATLAB and then trying?
回答(2 个)
Star Strider
2014-5-13
If this wouldn’t interfere with other file operations you’re doing:
fclose('all')
might work.
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!