Main Content


Custom data


Manipulate custom data for a data acquisition session object using the UserData property. The property is never read-only. Its value can be any MATLAB® data type and format.


Create a session and define its UserData property fields.

s = daq.createSession('ni');
s.UserData.Data = [];
s.UserData.TimeStamps = [];
s.UserData.StartTime = [];

Set the start time, and append event information to the log fields stored in UserData.

s.UserData.StartTime = eventData.TriggerTime;
s.UserData.Data = [s.UserData.Data; eventData.Data];
s.UserData.TimeStamps = [s.UserData.TimeStamps; eventData.TimeStamps];