When I tried to load a .mat file, there was an error: cannot read file. The data is from exported from simulink using "to Workspace" block.
I have tried adding the folder into the path, but the error is still there.
>> load('Data.mat')
Error using load
Cannot read file C:\Users\Desktop\Work\Varying\Type1\Data.mat.

댓글 수: 4

stozaki
stozaki 2020년 2월 9일
addpath(genpath(('C:\Users\Desktop\Work\Varying\Type1\')));
load('Data.mat');
Walter Roberson
Walter Roberson 2020년 2월 9일
The problem is not in locating the file so addpath is not going to help here.
The file was found in the indicated location but the user did not have permission to read it, or it is locked.
Possibly the file is empty, but I seem to recall that you get a different message for that.
You would get a different message if the file exists and is readable but is not valid.
Is it possible that Simulink still has the model running? The file might be locked if so.
EngTat Chung
EngTat Chung 2020년 2월 9일
I have stopped the Simulink model. The file was saved yesterday and I am trying to open it today. However was met with that error.
EngTat Chung
EngTat Chung 2020년 2월 9일
I tried using the code but it does not work too.
I ran the model to get the data again and saved the workspace. When I restarted my computer this time there was no error however there was no data loaded too.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jesús Zambrano
Jesús Zambrano 2020년 3월 27일

0 개 추천

Could you replicate this behavior? I would also like to know the size of this mat-file.

카테고리

도움말 센터File Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

제품

릴리스

R2019b

태그

질문:

2020년 2월 9일

답변:

2020년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by