I am logging data using a File Scope on my target PC. To prevent loss of data, I would like to rename the files once the model has stopped running.
I read this post about renaming files on boot: http://www.mathworks.de/matlabcentral/answers/36751
Is there some way to modify this so that it occurs after the model stops?
Note that the post you mention is for xPC Target Embedded Option, not sure if data files get deleted between reboots for the standard xPC Target (not Embedded Option).
How about transferring the data from the target PC to the host PC at the end of the run? You can then archive the data in MAT files on the host files as you wish. Check out xPC Target Data Logging Methodologies and xPC File Scope Tools on the File Exchange.
There may also be functions in the xPC file system that allow you to rename files on the target PC, but you would need to check the doc for your version of xPC Target. From what I could find, there weren't any in previous versions.