Error with tempname and tempdir
조회 수: 17 (최근 30일)
이전 댓글 표시
Recently I noticed that tempname and tempdir are not working anymore on my computer. Any ideas about why I get the following error messages? I checked and I have the ...Local\Temp folder where it is supposed to be...
>> tmp_nam = tempname
Error using cd
Cannot CD to C:\Users\Razvan\AppData\Local\Temp (Name is nonexistent or not a directory).
Error in tempdir (line 31)
curr_dir = cd(tmp_dir);
Error in tempname (line 18)
dirname = tempdir;
>> tmp_folder = tempdir
Error using cd
Cannot CD to C:\Users\Razvan\AppData\Local\Temp (Name is nonexistent or not a directory).
Error in tempdir (line 31)
curr_dir = cd(tmp_dir);
If I run Matlab "as Administrator" then the 2 commands work...
Thanks, Razvan
댓글 수: 2
swati khan
2016년 10월 18일
Right_Click_Matlab_Shortcut < Properties < Shortcut < Advanced < Select Run as Administrator < OK < OK
답변 (4개)
Walter Roberson
2013년 1월 17일
Possibly one of the directories along the way does not allow you read permission (or, if it was Unix, execute permission would be needed.) Use Windows Explorer to check the Security Settings on the path; also verify that the directory is owned by you.
댓글 수: 2
Image Analyst
2013년 1월 19일
Those commands work fine for me and I'm not running as administrator.
>> tmp_nam = tempname
tmp_nam =
C:\Users\Razvan\AppData\Local\Temp\tpdcd91567_4e74_43ae_aaf4_64dec3b0aa6d
>> tmp_folder = tempdir
tmp_folder =
C:\Users\Razvan\AppData\Local\Temp\
Both the file and folder you're allowed to write to even if you don't have admin authority. What I don't understand is why it's trying to cd to the folder. The help says "tmp_folder = tempdir returns the name of the system's temporary folder, if one exists. This function does not create a new folder. " so it's not supposed to create it or change to it. Are you sure you didn't redefine them? What does "which -all tempdir" say?
댓글 수: 8
Image Analyst
2013년 5월 7일
You do not have permission to write to that folder, I don't think. It has to be in the Documents subfolder of that.
Razvan
2013년 1월 20일
댓글 수: 1
Daniel Pereira
2013년 5월 7일
Thank you very much, I had the same problem and could not even run simulink, unless I run Matlab as administrator (which was a problem as files I opened from windows explorer were opening on a new instance of matlab).
Thanks everyone who helped us!
Sebastian Pakula
2020년 7월 27일
I had a similar problem, but the problem was Dropbox folder which prevent getting access to it. The solution is to stop synchronizing Dropbox during the running program.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!