Why do I get a Simulink diagnostic error saying "Error opening or closing file'"?
45 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 18 Jan. 2019
Bearbeitet: MathWorks Support Team
am 30 Nov. 2020
Why do I get a Simulink diagnostic block error saying:
Diagnostic reported from block 'myModel/From File'
Caused by:
Error opening or closing file 'myFile.mat'
Akzeptierte Antwort
MathWorks Support Team
am 1 Dez. 2020
Bearbeitet: MathWorks Support Team
am 30 Nov. 2020
When the error is reported from a "From File" block:
Possible causes for the error message may be the following:
1. The "From File" block only works for regular binary MAT-files, not for any text-based ASCII files. To test if your MAT-file is an ASCII file, run the following command on it and see of the following error message appears:\nTo generate a binary MAT-file, make sure that you create your MAT-file by using the "save" command, instead of file I/O commands ("fopen","fwrite",etc.).
>> matfile('myFile.mat');
Unable to read MAT-file
C:\temp\myFile.mat:
not a binary MAT-file.
2. Verify that you are able to load your MAT-file into workspace using the "load" command:\nIf this fails, your MAT-file is corrupt and will not work with the "From File" block either.
>> load('myFile.mat');
3. This diagnostic may indicate that the MAT-file is a location where the user does not have read permissions. Contact your system administrator for further assistance.
When the error is reported from a "To File" block:
This diagnostic can indicate that the MATLAB current folder path is a location where the user does not have read/write permissions. To figure out your MATLAB current folder path, use the command "pwd" or look in the MATLAB current folder toolbar.
To work around the issue, contact your system administrator to give read/write permissions, or change your MATLAB current folder path to another location.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Configure and View Diagnostics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!