Unique name for temporary file
tmpName = tempname returns a character vector containing a unique path
for a temporary file in your system’s temporary folder.
tmpName = tempname( returns a
unique path for a temporary file in the specified folder.
Create Temporary File Name with Extension
Create a temporary file name that has the extension,
.dat, by concatenating two character vectors.
tmpName = [tempname,'.dat'];
Create Temporary File Name in Folder
Create a temporary file name for use in the
tmpName = tempname('C:\myTemporaryFiles');
Write Data to Temporary File
Create a temporary file name.
filename = tempname;
Create a new file with the temporary file name, and write data to the file.
fileID = fopen(filename,'w'); fwrite(fileID,magic(5)); fclose(fileID);
folderName — Folder name
string scalar | character vector
Folder name, specified as a string scalar or a character vector containing the folder name.
Introduced before R2006a