impossible to accede to a file with fopen
1 回表示 (過去 30 日間)
古いコメントを表示
With Matlab 2012b + simulink, I use a Matlab function to write data in a .txt file. Sometime, a problem to accede to the file occurs. The problem is that a window appears: title of the window is "Remote". The window contain the following text (in french): "Impossible to accede to the file "Elapsed_Real_Time.txt. Continue to try to communicate? YES/NO"
When the window appears, it stops the access to the file and the data is not written anymore.
The model was working with matlab 2007. Is it necessary to a code line to avoid the problem.
function Matlab_to_WM(u)
coder.extrinsic('dlmwrite');
coder.extrinsic('fopen');
coder.extrinsic('fclose');
fid=double(0);
fid=fopen('D:\damien\Echange_donnees_System\Elapsed_Real_Time.txt', 'w');
if fid ~= -1 && fid ~= 2
dlmwrite('D:\damien\Echange_donnees_System\Elapsed_Real_Time.txt' , u , 'newline', 'pc');
end
fclose('all');
end
0 件のコメント
回答 (1 件)
参考
カテゴリ
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!