Skip to Main Content Skip to Search
Product Documentation

analoginput - Create analog input object

Syntax

AI = analoginput('adaptor')
AI = analoginput('adaptor',ID)

Description

AI = analoginput('adaptor') creates the analog input object AI for a sound card having an ID of 0 (adaptor must be winsound). This is the only case where ID is not required.

AI = analoginput('adaptor',ID) creates the analog input object AI for the specified adaptor and for the hardware device with device identifier ID. ID can be specified as an integer or a string.

Tips

Creating Analog Input Objects

Hardware Device Identifier

When data acquisition devices are installed, they are assigned a unique number which identifies the device in software. The device identifier is typically assigned automatically and can usually be manually changed using a vendor-supplied device configuration utility. National Instruments refers to this identifier as the device name.

For sound cards, the device identifier is typically not exposed to you through the Microsoft® Windows® environment. However, Data Acquisition Toolbox software automatically associates each sound card with an integer ID value. There are two cases to consider:

There are two ways you can determine the ID for a particular device:

Input Arguments

adaptor

The hardware driver adaptor name. The supported adaptors are advantech, , mcc, nidaq, and winsound.

ID

The hardware device identifier. ID is optional if the device object is associated with a sound card having an ID of 0.

Output Arguments

AI

The analog input object.

Properties

Basic Setup

SampleRateSpecify per-channel rate at which analog data is converted to digital data, or vice versa
SamplesPerTriggerSpecify number of samples to acquire for each channel group member for each trigger that occurs
TriggerTypeSpecify type of trigger to execute

Channel Properties

ChannelNameSpecify descriptive channel name
HwChannelSpecify hardware channel ID
HwLineSpecify hardware line ID
IndexMATLAB index of hardware channel or line
InputRangeSpecify range of analog input subsystem
NativeOffsetIndicate offset to use when converting between native data format and doubles
NativeScalingIndicate scaling to use when converting between native data format and doubles
ParentIndicate parent (device object) of channel or line
SensorRangeSpecify range of data expected from sensor
TypeIndicate device object type, channel, or line
UnitsSpecify engineering units label
UnitsRangeSpecify range of data as engineering units

Trigger Properties

InitialTriggerTimeAbsolute time of first trigger
ManualTriggerHwOnSpecify hardware device starts at manual trigger
TriggerChannelSpecify channel serving as trigger source
TriggerConditionSpecify condition that must be satisfied before trigger executes
TriggerConditionValueSpecify voltage value(s) that must be satisfied before trigger executes
TriggerDelaySpecify delay value for data logging
TriggerDelayUnitsSpecify units in which trigger delay data is measured
TriggerFcnSpecify callback function to execute when trigger occurs
TriggerRepeatSpecify number of additional times trigger executes
TriggersExecutedIndicate number of triggers that execute
TriggerTypeSpecify type of trigger to execute

Logging Properties

LogFileNameSpecify name of disk file information is logged to
LoggingIndicate whether data is being logged to memory or disk file
LoggingModeSpecify destination for acquired data
LogToDiskModeSpecify whether data, events, and hardware information are saved to one or more disk files

Status Properties

LoggingIndicate whether data is being logged to memory or disk file
RunningIndicate whether device object is running
SamplesAcquiredIndicate number of samples acquired per channel
SamplesAvailableIndicate number of samples available per channel in engine

Hardware Configuration Properties

ChannelSkewSpecify time between consecutive scanned hardware channels
ChannelSkewModeSpecify how channel skew is determined
ClockSourceSpecify clock that governs hardware conversion rate
InputTypeSpecify analog input hardware channel configuration
SampleRateSpecify per-channel rate at which analog data is converted to digital data, or vice versa

Callback Properties

DataMissedFcnSpecify callback function to execute when data is missed
InputOverRangeFcnSpecify callback function to execute when acquired data exceeds valid hardware range
RuntimeErrorFcnSpecify callback function to execute when run-time error occurs
SamplesAcquiredIndicate number of samples acquired per channel
SamplesAcquiredFcnSpecify callback function to execute when predefined number of samples is acquired for each channel group member
SamplesAcquiredFcnCountSpecify number of samples to acquire for each channel group member before samples acquired event is generated
StartFcnSpecify callback function to execute before device object runs
StopFcnSpecify callback function to execute after device object runs
TimerFcnSpecify callback function to execute when predefined time period passes
TimerPeriodSpecify time period between timer events
TriggerFcnSpecify callback function to execute when trigger occurs

General Purpose Properties

BufferingConfigSpecify per-channel allocated memory
BufferingModeSpecify how memory is allocated
ChannelContain hardware channels added to device object
EventLogStore information for specific events
NameSpecify descriptive name for the channel
TagSpecify device object label
TimeoutSpecify additional waiting time to extract or queue data
TypeIndicate device object type, channel, or line
UserDataStore data to associate with device object

Examples

To create an analog input object for a National Instruments device defined as 'Dev1':

AI = analoginput('nidaq','Dev1');

To create an analog input object for a Measurement Computing device defined as '1':

AI = analoginput('mcc','1');

Alternatives

See Also

addchannel | daqhwinfo

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS