Error: No such file or directory

So, i have a function called 'MatrixPicture', which uses data that is PMHFIB_ORIGINAL.ATT. file. To open the .att file, I'm using a secondary function called 'Read_Att2'. However, when I call on the .att file, I get the message: "no such file or directory found."
Below, is my code for my MatrixPicture function that is calling on Read_Att2. How do I fix this issue? Read_Att2 is located in the folder on the desktop known as PHYS4115Mfiles, while PMHFIB_ORIGINAL.ATT is located in PHYS4115Tables on my desktop. I am on Mac Book air.
function [t,EIS] = MatrixPicture (min,max,m,n)
drive_name ='/Users/kira/desktop/';
addpath '/Users/kira/desktop/PHYS4115Mfiles';
filename ='C:\User\kira\desktop\PHYS4115Tables\att\PMHFIB_original.ATT';
%flux is temp variable
[E,mewfib]=Read_Att2([drive_name,'\PHYS4115Tables\att\PMHFIB_ORIGINAL.ATT']);

3 件のコメント

per isakson
per isakson 2019 年 11 月 10 日
Two comments
  • you are mixing \ and / as file separator.
  • you use relative paths, thus the current directory is important.
/ never used a MacOS
Walter Roberson
Walter Roberson 2019 年 11 月 10 日
MS Windows recognizes both \ and / as path separators, but Mac and Linux only recognize / as path separators and treat \ as the escape character sequence (for example \n would be "newline")
per isakson
per isakson 2019 年 11 月 19 日
Either
addpath('/Users/kira/desktop/PHYS4115Mfiles'); % with blips
or
addpath /Users/kira/desktop/PHYS4115Mfiles % without blips

サインインしてコメントする。

回答 (2 件)

mervin Francis
mervin Francis 2020 年 4 月 30 日
編集済み: per isakson 2020 年 4 月 30 日

0 投票

1 件のコメント

Walter Roberson
Walter Roberson 2020 年 5 月 1 日
As outside people who have never seen your computer, we have no reason to expect that a file with the exact name FracturesNoisy.mat is anywhere on your MATLAB path.
I suggest you
ls Fract*
to see what names are available in your current directory

サインインしてコメントする。

Yandy
Yandy 2023 年 10 月 6 日

0 投票

Hi guys.
If anyone has trouble saving a .mat file and keps seeing the error 'no such file or directory exists', please try the following:
on the matlab Home tab, under variables, you will see 'save worspace' and 'clear workspace'
click on save workspace, and then pick the name of your file.
Matlab will now recognise the file and folder, and you can do whatever you want to do with the said file later on.
if this works for you too, please let me know as I really struggled for days with this

カテゴリ

ヘルプ センター および File ExchangeSearch Path についてさらに検索

製品

リリース

R2017b

質問済み:

2019 年 11 月 10 日

回答済み:

2023 年 10 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by