creating a temporary file in specified directory

조회 수: 6 (최근 30일)
Don S
Don S 2013년 11월 12일
답변: David Sanchez 2013년 11월 12일
HI,
I would like to know the possibility of creating a temporary file in a specified drive rather than in c:\....temp\. using the matlab function name "tempname". My OS in windows 7 and the program is not running in C drive. So when I import the created file using the function "importdata". It shows an error
??? Error using ==> importdata at 136
Unable to open file.

답변 (2개)

The Matlab Spot
The Matlab Spot 2013년 11월 12일
The function ...
getenv('TEMP');
shows the current path of the temporary directory in which the temporary files will be generated on your system. The TEMP environment variable will hold this path.
For changing this path to your desired directory use... say 'C:\'
setenv('TEMP','C:\');

David Sanchez
David Sanchez 2013년 11월 12일
You can import a file from wherever directory it is. Just point to the full direction:
importdata('D:\my_dir1\mydir2\my_Data.mat');
To create a new temp file, you can follow this instruction:
Once you change the location of your temp file,
tmp_folder = tempdir;
will return the new location.

카테고리

Help CenterFile Exchange에서 Manage Products에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by