Analog Output (Single Sample)

Output single sample to multiple analog channels of data acquisition device


Data Acquisition Toolbox™


Some devices are not supported by the Simulink® blocks in Data Acquisition Toolbox. To see if your device supports Simulink, refer to Supported Hardware.


The Analog Output (Single Sample) block opens, initializes, configures, and controls an analog data acquisition device. The opening, initialization, and configuration of the device occur once at the start of the model execution. The block outputs a single sample every time step, synchronously to the hardware, during the model run time.

The block has one or more input ports, depending on the option you choose in its dialog box. It has no output ports. The valid data type of the signal at the input port is double.

The Analog Output (Single Sample) block inherits the sample time from the driving block connected to the input port. Analog output is done synchronously, according to the following diagram.

At the first time step (T1), data is output to the selected hardware channels. The simulation does not continue until data is output to all channels.


To use this block, you need both Data Acquisition Toolbox and Simulink software.

You can use the Analog Output (Single Sample) block only with devices that support single sample output. To send data using devices that do not support acquisition of a single sample (such as devices designed for sound and vibration), use the Analog Output block.

Other Supported Features

  • This block supports the use of Simulink Accelerator™ mode, but not Rapid Accelerator or code generation.

  • The block supports the use of model referencing, so that your model can include other Simulink models as modular components.

For more information on these features, see the Simulink documentation.

Dialog Box

Use the Block Parameters dialog box to select your device and to set other configuration options.


The data acquisition device from which you want to acquire data. The items in the list vary, depending on which devices you have connected to your system. Devices in the list are specified by adaptor/vendor name and unique device ID, followed by the model name of the device, for example, ni Dev1 (USB-6255). The first available device is selected by default. CompactDAQ chassis would be shown as a single device; vendor name, chassis ID, and chassis model would be shown in the list, for example, ni cDAQ2 (cDAQ-9172).


The channel configuration table lists your device's hardware channels and lets you configure them. These parameters are specified for each selected channel:

Channel ID — Hardware channel ID specified by the device. The Channel ID column is read-only, and the parameters are defined when the device is selected.

Name — Channel name. By default the table displays any names provided by the hardware, but you can edit the names. For example, if the device is a sound card with two channels, you can name them Left and Right.

Module — Displays the Device ID the channel belongs to. The Module column is read-only. If a CompactDAQ chassis is selected, it will show the ID of the CompactDAQ module which the channel belongs to; otherwise it will show the ID of the device.

Measurement Type — Specifies the measurement type of the channel. This block supports only voltage measurement types. (For other measurement types, use a data acquisition session in MATLAB®.)

Output Range — Specifies the output ranges available for each channel supported by the hardware, and is defined when a device is selected.

Number of ports

1 for all channels (default) — One input port on the block for all channels. Provide data as a column vector with size number of channels by 1

1 per channel — N input ports on the block, where N is equal to the number of selected channels. Provide each port’s data size as 1-by-1. For naming, each output port uses the channel name if one was specified, otherwise the channel ID, for example, ai0.

Sample time

Specifies the sample time of the block during the simulation. This is the rate at which the block is executed during simulation. The default value is 1. For more information, see What Is Sample Time? (Simulink).

Introduced in R2016b