Why do I get a Simulink diagnostic error saying "Error opening or closing file'"?

45 Ansichten (letzte 30 Tage)
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
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:\n
>> matfile('myFile.mat');
Unable to read MAT-file
C:\temp\myFile.mat:
not a binary MAT-file.
To 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.).
2. Verify that you are able to load your MAT-file into workspace using the "load" command:\n
>> load('myFile.mat');
If this fails, your MAT-file is corrupt and will not work with the "From File" block either.
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.

Weitere Antworten (0)

Kategorien

Mehr zu Configure and View Diagnostics finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by