Quantcast

Documentation Center

  • Trial Software
  • Product Updates

getvalue

Read values from digital input and output lines

Syntax

out = getvalue(obj)
out = getvalue(obj.Line(index))

    Note:   You cannot use the legacy interface on 64–bit MATLAB®. See Session-Based Interface to acquire and generate data.

Arguments

obj

A digital I/O object.

obj.Line(index)

One or more lines contained by obj.

out

A binary vector.

Description

out = getvalue(obj) returns the current value from all lines contained by obj as a binary vector to out.

out = getvalue(obj.Line(index)) returns the current value from the lines specified by obj.Line(index).

Examples

Create the digital I/O object dio and add eight input lines to it.

dio = digitalio('nidaq','Dev1');
lines = addline(dio,0:7,'in');

To return the current values from all lines contained by dio as a binvec value:

out = getvalue(dio);

More About

expand all

Tips

More About Reading Values from Lines

  • By default, out is returned as a binary vector (binvec). A binvec value is constructed with the least significant bit (LSB) in the first column and the most significant bit (MSB) in the last column. For example, the decimal number 23 is written as the binvec value [1 1 1 0 1].

  • You can convert a binvec value to a decimal value with the binvec2dec function.

  • If obj contains lines from a port-configurable device, the data acquisition engine will automatically read from all the lines even if they are not contained by the device object.

  • When obj contains lines configured for output, getvalue returns the most recently output value set by putvalue. If you have not called putvalue since you created the digitalio object, then getvalue returns a 0. getvalue cannot ascertain the current output value on the hardware.

    Note:   Refer to the Hardware Limitations by Vendor section before you access National Instruments® devices with the NI-DAQmx adaptor simultaneously from multiple applications.

See Also

Was this topic helpful?