How to permanently change the temp directory matlab uses?

58 ビュー (過去 30 日間)
Theo
Theo 2014 年 9 月 25 日
コメント済み: Atriya Biswas 2020 年 2 月 3 日
I saw the following in another post for changing the temp directory. However I believe everytime Matlab restarts the TEMP directory is reset to the c:\temp folder.
tempdir
clear all
setenv('TEMP','NEW_DIRECTORY_PATH') % TEMP for Windows
tempdir
I am running out of space in C:. I should move the temp folder permanently to another drive. Can anyone give me a suggestion? Thanks

採用された回答

José-Luis
José-Luis 2014 年 9 月 25 日
  2 件のコメント
Theo
Theo 2014 年 9 月 25 日
Thanks.
José-Luis
José-Luis 2014 年 9 月 25 日
My pleasure.

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

その他の回答 (1 件)

Thomas Richards
Thomas Richards 2018 年 2 月 22 日
This does not work for me. when I use setenv(), the ouput of tempdir is unchanged. I have tried this on my desktop using Matlab and I am also trying to use this on a linux cluster, so changing admin rights etc is not really an option.
K>> tempdir
ans =
'C:\Users\bs11t2r\AppData\Local\Temp\'
K>> setenv('TEMP', 'C:\Somewhereelse\') K>> tempdir
ans =
'C:\Users\bs11t2r\AppData\Local\Temp\'
  3 件のコメント
Lucas Bruck
Lucas Bruck 2018 年 7 月 13 日
編集済み: Lucas Bruck 2018 年 7 月 13 日
Try to use 'TMP' or 'tmp' instead of 'TEMP', I am using a Linux cluster too and it worked for me. The code became:
tempdir
clear all
setenv('TMP','NEW_DIRECTORY_PATH') % TEMP for Windows
tempdir
Atriya Biswas
Atriya Biswas 2020 年 2 月 3 日
Thanks Lucas!!!
>> clear('tempdir')
>> setenv('tmp','D:\Matlab_temp\')
then type
>> tempdir
Matlab Yields
ans =
'D:\Matlab_temp\'
This is implemented in 2019b version

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

カテゴリ

Help Center および File ExchangeFile Name Construction についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by