Main Content

Device Groups

Working with Group Objects

Device groups are used to group several related properties. For example, a channel group might contain the input channels of an oscilloscope, and the properties and methods specific to the input channels on the instrument.

MATLAB® instrument drivers specify the type and quantity of device groups for device objects.

Group objects can be accessed via the get command. For the Tektronix® TDS 210 oscilloscope, there is a channel group that contains two group objects. The device property to access a group is always the group name.

chans = get(d, 'Channel')

   HwIndex:    HwName:    Type:            Name:  
   1           CH1        scope-channel    Channel1
   2           CH2        scope-channel    Channel2

To display the functions that a device group object supports, use the methods function.


You can also display a list of the group object's properties and their current settings.


To get help on a driver-specific property or function, use the instrhelp function, with the name of the function or property.


Using Device Groups to Access Instrument Data

This example shows how to obtain waveform data from a Tektronix TDS 210 oscilloscope with a square wave signal input on channel 1, on a Windows® machine. The methods used are specific to this instrument:

  1. Create and connect — First, create the device object for the oscilloscope and then connect to the instrument.

    s = serial('com1');
    d = icdevice('tektronix_tds210', s);
  2. Get the device group — To retrieve waveform data, first gain access to the Waveform group for the device object.

    w = d.waveform;

    This group is specific for the hardware you are using. The TDS 210 oscilloscope has one Waveform; therefore the group contains one group object.

    HwIndex:    HwName:      Type:             Name:    
    1           Waveform1    scope-waveform    Waveform1
  3. Obtain the waveform — Now that you have access to the Waveform group objects, you can call the readwaveform function to acquire the data. For this example, channel 1 of the oscilloscope is reading the signal. To access this channel, call readwaveform on the first channel.

    wave = invoke(w, 'readwaveform', 'channel1');
  4. View the data — The wave variable now contains the waveform data from the oscilloscope. Use the plot command to view the data.

  5. Disconnect and clean up — Once the task is done, disconnect the hardware and free the memory used by the objects.

    delete([d s])
    clear d, s, w, wave;