Specify whether data and event information are saved to one record file or to multiple record files
You can configure RecordMode to be overwrite, append, or index. If RecordMode is overwrite, the record file is overwritten each time recording is initiated. If RecordMode is append, data is appended to the record file each time recording is initiated. If RecordMode is index, a different record file is created each time recording is initiated, each with an indexed filename.
You can configure RecordMode only when the object is not recording. You terminate recording with the record function. A object that is not recording has a RecordStatus property value of off.
You specify the record filename with the RecordName property. The indexed filename follows a prescribed set of rules. For a description of these rules, see Specifying a Filename.
The record file is overwritten.
Data is appended to an existing record file.
A different record file is created, each with an indexed filename.
Suppose you create the serial port object s associated with the serial port COM1.
s = serial('COM1'); fopen(s)
Specify the record filename with the RecordName property, configure RecordMode to index, and initiate recording.
s.RecordName = 'MyRecord.txt'; s.RecordMode = 'index'; record(s)
The record filename is automatically updated with an indexed filename after recording is turned off.
record(s,'off') s.RecordName ans = MyRecord01.txt
Disconnect s from the peripheral device, remove s from memory, and remove s from the MATLAB® workspace.
fclose(s) delete(s) clear s