when I load a mat file, it shows" unable to read file, no such file or directory"

24 次查看(过去 30 天)
I recently installed a matlab 2014(a), but when I try to load my old mat or m files, the command window shows: Error using load Unable to read file '.mat': no such file or directory.
  2 个评论
nour ben farhat
nour ben farhat 2021-9-3
Unable to read file '..\Meteomatics\Data\MeteomaticsData_20170624.mat'. No such file or directory.
Qaiser Javed
Qaiser Javed 2022-1-1
change your current directory to that location where your old file is placed or copy that file to current directory.

请先登录,再进行评论。

回答(4 个)

Azzi Abdelmalek
Azzi Abdelmalek 2014-8-17
Check if your file is in the current folder
dir your_file_name.mat

Harvy Jack
Harvy Jack 2020-5-6
Most likely, the problem is that you're using a relative file path to open the file, but the current working directory isn't set to what you think it is.
It's a common misconception that relative paths are relative to the location of the python script, but this is untrue. Relative file paths are always relative to the current working directory, and the current working directory doesn't have to be the location of your python script.
You have three options:
  • Use an absolute path to open the file.
  • Generate the path to the file relative to your python script.
  • Change the current working directory before opening the file

Maaz Ali Khan
Maaz Ali Khan 2019-1-29
Hey
Did you find out the solution of this problem?
i have also faced that type of problem.

Wafaa Bdr
Wafaa Bdr 2020-2-7
can you please explain to us how did you fixe this problem, i'm at the same situation as yours.
thank you

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by