Data Acquisition Toolbox
  Function/Property:
    Search    Help Desk 
daqread    Examples   See Also

Read a Data Acquisition Toolbox (.daq) file.

Syntax

data = daqread('file');

data = daqread('file','P1, V1, 'P2', V2,...);

[data, time] = daqread(...);

[data, time, abstime] = daqread(...);

[data, time, abstime, events] = daqread(...);

[data, time, abstime, events, daqinfo] = daqread(...);

daqinfo = daqread('file','info');

Description

data = daqread('file') reads all the data from file and returns an m-by-n data matrix, data, where m is the number of samples and n is the number of channels. If data from multiple triggers is read, each trigger is separated by a NaN and m is increased by the number of triggers.

data = daqread('file','P1', V1, 'P2', V2,...) reads the specified data from file and returns an m-by-n matrix to data, where m is the number of samples and n is the number of channels. If data from multiple triggers is read, each trigger is separated by a NaN and m is increased by the number of triggers. The amount of data returned and the format of that data is specified with property name/property value pairs. The available properties and values are given below.

Property
Data Type
Description
Samples

MATLAB vector

Specifies the sample range.

Time

MATLAB vector

Specifies the time range.

Triggers

MATLAB vector

Specifies the trigger range.

Channels

MATLAB vector or cell array

Specifies the channel range. Channel names can be specified as a cell array.

DataFormat

{double}|native

Specifies the data format as doubles or native.

TimeFormat

{vector}|matrix

Specifies the time format as a vector or a matrix.

The Samples, Time, and Triggers properties are mutually exclusive. The Time property must be specified as a datenum value. This allows event times to be used as the range.

[data, time] = daqread(...) returns sample-time pairs.

[data, time, abstime] = daqread(...) returns sample-time pairs and the absolute time of the first trigger. abstime is returned as a datenum value and can be converted to a string using datestr.

[data, time, abstime, events] = daqread(...) returns sample-time pairs, the absolute time of the first trigger, and a log of events. abstime is returned as a datenum value and can be converted to a string using datestr. events contains the appropriate event structure based on the samples, triggers or time specified. The entire event log is returned only if samples, time, and triggers are not specified.

[data, time, abstime, events, daqinfo] = daqread(...) returns sample-time pairs, the absolute time, the event log, and the structure 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 events structure is identical to the information returned by daqinfo.ObjInfo.EventLog. The entire event log is returned only if samples, time, and triggers are not specified.

daqinfo = daqread('file','info') returns the structure daqinfo, which contains two fields: ObjInfo and HwInfo. ObjInfo is a structure containing property/value pairs and HwInfo is a structure containing hardware information. The entire event log is returned to daqinfo.ObjInfo.EventLog.

Note:
Data Acquisition Toolbox (.daq) files are created by specifying a value for the LogFileName property and setting LoggingMode to Disk or Disk&Memory.

Example

National Instruments

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.

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 the file data.daq

To read samples 500 to 1000 for all channels 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

To return the absolute time of the first logged event (the start event) and convert the time from a datenum value to a string

See Also

Properties

LogFileName, LoggingMode, LogToDiskMode



[ Previous | Help Desk | Next ]