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

24 visualizaciones (últimos 30 días)
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 comentarios
nour ben farhat
nour ben farhat el 3 de Sept. de 2021
Unable to read file '..\Meteomatics\Data\MeteomaticsData_20170624.mat'. No such file or directory.
Qaiser Javed
Qaiser Javed el 1 de En. de 2022
change your current directory to that location where your old file is placed or copy that file to current directory.

Iniciar sesión para comentar.

Respuestas (4)

Azzi Abdelmalek
Azzi Abdelmalek el 17 de Ag. de 2014
Check if your file is in the current folder
dir your_file_name.mat
  2 comentarios
Maria Sheeba
Maria Sheeba el 27 de Dic. de 2016
Yes..It was in the correct directory..Still it shows this kind of error.Now, what is the solution for it?
Thumree Sarkar
Thumree Sarkar el 7 de Nov. de 2017
Sometimes the path problem happens. I use
addpath(fullfile('your_path'));

Iniciar sesión para comentar.


Harvy Jack
Harvy Jack el 6 de Mayo de 2020
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 el 29 de En. de 2019
Hey
Did you find out the solution of this problem?
i have also faced that type of problem.
  1 comentario
Thumree Sarkar
Thumree Sarkar el 30 de En. de 2019
Can you please specify the problem? Otherwise see the comments to the thread hope that can help.

Iniciar sesión para comentar.


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

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by