| Data Acquisition Toolbox | ![]() |
Read a Data Acquisition Toolbox (.daq) file
Syntax
data = daqread('file')data = daqread('file','PropertyName',PropertyValue,...)[data,time] = daqread(...)[data,time,abstime] = daqread(...)[data,time,abstime,events] = daqread(...)[data,time,abstime,events,daqinfo] = daqread(...)daqinfo = daqread('file','info')
Arguments
Description
reads all the data from data = daqread('file')
file. data is an m-by-n data matrix where m is the number of samples and n is the number of channels. If data includes data from multiple triggers, then m is increased by the number of triggers because of the addition of NaN's.
reads the specified data from data = daqread('file','PropertyName',PropertyValue,...)
file. The amount of data returned and the format of the data is specified with the properties shown below.
The Samples, Time, and Triggers properties are mutually exclusive.
returns sample-time pairs. [data,time] = daqread(...)
time is a vector with the same length as data and contains the relative time for each sample. Relative time is measured with respect to the first trigger that occurs.
returns sample-time pairs and the absolute time of the first trigger. [data,time,abstime] = daqread(...)
abstime is returned as a clock vector.
returns sample-time pairs, the absolute time of the first trigger, and a log of events. [data,time,abstime,events] = daqread(...)
events contains the appropriate events based on the Samples, Time, or Triggers value specified. The entire event log is returned only if Samples, Time, or Triggers is not specified.
returns sample-time pairs, the absolute time, the event log, and the structure [data,time,abstime,events,daqinfo] = daqread(...)
daqinfo, which contains two fields: ObjInfo and HwInfo. ObjInfo is a structure containing property name/property value pairs and HwInfo is a structure containing hardware information. The entire event log is returned to daqinfo.ObjInfo.EventLog.
returns the structure daqinfo = daqread('file','info')
daqinfo, which contains two fields: ObjInfo and HwInfo. ObjInfo is a structure containing property name/property value pairs and HwInfo is a structure containing hardware information. The entire event log is returned to daqinfo.ObjInfo.EventLog.
More About .daq Files
daqread to return data, relative time, absolute time, and event information is identical to the format used by the getdata function.
NaN.
ObjInfo.EventLog always contains the entire event log regardless of the value specified by Samples, Time, or Triggers.
UserData property value is not restored when you return device object (ObjInfo) information.
daq) files are created by specifying a value for the LogFileName property (or accepting the default value), and configuring the LoggingMode property to Disk or Disk&Memory.
Example
Suppose you configure the analog input object ai for a National Instruments board as shown below. The object acquires one second of data for four channels, and saves the data to the output file data.daq.
ai = analoginput('nidaq',1); chans = addchannel(ai,0:3); set(ai,'SampleRate',1000) ActualRate = get(ai,'SampleRate'); set(ai,'SamplesPerTrigger',ActualRate) set(ai,'LoggingMode','Disk&Memory') set(ai,'LogFileName','data.daq') start(ai)
After the data has been collected and saved to a disk file, you can retrieve the data and other acquisition-related information using daqread. To read all the sample-time pairs from data.daq:
To read samples 500 to 1000 for all channels from data.daq:
To read the first 0.5 seconds of data for channels 1 and 2 from data.daq:
To obtain the channel property information from data.daq:
To obtain a list of event types and event data contained by data.daq:
daqinfo = daqread('data.daq','info'); events = daqinfo.ObjInfo.EventLog; event_type = {events.Type}; event_data = {events.Data};
Functions
Properties
EventLog, LogFileName, LoggingMode, LogToDiskMode
| daqpropedit | daqregister | ![]() |