How could I fix this file path error?

36 次查看(过去 30 天)
Asuka
Asuka 2024-7-15,17:15
评论: Image Analyst 2024-7-20,4:12
Don't know how I can fix this filepath issue..

回答(2 个)

Muskan
Muskan 2024-7-15,18:02
When you run a MATLAB file, your current folder (often displayed on the left hand side) must be the one where that file is stored. If you do not specify a path to a file, MATLAB looks for the file in the current folder or on the search path. Functions in the current folder take precedence over functions with the same file name that reside anywhere on the search path.
You can refer to the following documentation on MATLAB Search Path for a better understanding: https://www.mathworks.com/help/matlab/matlab_env/what-is-the-matlab-search-path.html
You can also refer to the following documentation of Files and Folders That MATLAB Accesses: https://www.mathworks.com/help/matlab/matlab_env/files-and-folders-that-matlab-accesses.html
  1 个评论
Asuka
Asuka 2024-7-19,20:44
Hello, thanks for your advice.
I modified current codes and attempted move image file folder to the same directory where .mat file is and gave the new path, but still get errors. Honestly don't know what to modify.

请先登录,再进行评论。


Image Analyst
Image Analyst 2024-7-16,3:27
Where does the MAT file actually live? If it is not in that folder, then type in the full path and name of the file.
  1 个评论
Image Analyst
Image Analyst 2024-7-20,4:12
Put the .mat file in the same folder as your m-file then set new path like this
newPath = pwd;

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by