MATLAB: Does the COPYFILE function preserve the original timestamp of the file copied using MATLAB 7.1 (R14SP3) on Mac OS 10.4.2

ArchitectureMATLABpermissionpermissionsplatformsstampstimestamptimestamps

I execute the following code using MATLAB 7.1 (R14SP3) on Mac OS 10.4.2:
copyfile temp1.txt temp2.txt %temp1.txt is a file in my current directory
I expect that the timestamp of temp2.txt should indicate the time when the file is created. This was true for earlier versions of MATLAB. However with MATLAB 7.1 (R14SP3), the timestamp of temp2.txt is the same as that of temp1.txt.

Best Answer

This enhancement has been incorporated in Release 2006b (R2006b). For previous product releases, read below for any possible workarounds:
The COPYFILE function in MATLAB 7.1 (R14SP3) preserves timestamps in the same way as the "cp -p" command on Mac OS 10.4.2. This change was made to make the function's behavior consistent across Windows and UNIX platforms.
To work around this issue, use the '!' operator with the "cp" command. The '!' operator indicates that the rest of the input line is a command to the operating system. For example:
! cp temp1.txt temp2.txt
does not preserve the original timestamp.
You can also use the SYSTEM function to execute operating system commands. For more information on this function, type
doc system
at the MATLAB Command Prompt.