MATLAB: XPC Target Embedded Filescope Dynamic File Naming

dynamic file namingfilescopeSimulink Real-Timexpc target embeddedxPC Target Embedded Option

I’m having trouble with the dynamic file naming of Filescope Blocks in xPC Embedded Option. I would like the file name of a scope to increment each time the software boots so I can record data from multiple test runs.
I have added '_<%%%>' to the file name (now ‘ins_<%%%>’) and checked ‘auto restart’ and ‘dynamic file naming’ (not that I want to limit the size of each file with ‘auto restart’ but it is the only way to get the ‘dynamic file naming’ box to appear). If I boot the software 3 times I get one file named ins_001.dat with the correct data in it, one file named ins_002.dat that is empty and only 1KB in size, file ins_003.dat is missing.
I have also tried running the software without either 'auto restart' or 'dynamic file namining' checked but that doesn't work.
Any ideas?

Best Answer

The dynamic file naming enables additional files to be created when the max file size is reached for a given file. Autorestart is not for logging across power cycles.
Each time the xPC (FreeDOS) starts the application file, new (mostly empty) data files for the scopes are created, replacing the ones from the previous power cycle.
What I did: To address the issue of preserving data between reboots, I modified the autoexec.bat file to backup my data files from the previous power cycle, before it loads the stand alone application. Due to FreeDOS command set limitations, I compiled an .exe that renames the files to include the current day & time. The autoexec calls my .exe to rename the files and then moves it to a data folder. I used the OpenWatcom compiler/IDE to make a compatible 32-bit DOS executable.
Keep in mind that the filenames are limited to 8 characters, not including the extension.
Related Question