Simulink Analog Input from NI cDAQ-9185?

9 ビュー (過去 30 日間)
Kyle Smith
Kyle Smith 2022 年 11 月 29 日
回答済み: Manoj Mirge 2023 年 3 月 20 日
Hello everyone, I am trying to send and read analog signals to/from Simulink using the NI cDAQ-9185 chasis that has an analog input (AI-9239) module and an analog output (AO-9269) module.
I have been successful in sending a signal to the cDAQ using the "Analog output (single sample)" block from the Data Aquisition Toolbox, but the "Analog input (single sample)" block from the same library doesn't appear to recognize the the connected device at all.
I have used the NI Max app to ensure the cDAQ device is "reserved" and have tested both modules. I then used the Matlab command line to see if the devices were recognized and they are. I got this:
>> d = daq.getDevices
d =
Data acquisition devices:
index Vendor Device ID Description
----- ------ ------------- ------------------------------------------------
1 ni Analog-Input National Instruments(TM) NI 9239
2 ni Analog-Output National Instruments(TM) NI 9269
3 ni SimDev1 National Instruments(TM) NI Simulated DAQ Device
I even went a step further and used the Matlab apps "Analog Input Recorder" and "Analog Ouput Generator" simulanteously to see if I could send and receive data, both worked.
In the pictures below are the block parameters. You can see in the Analog Ouput block it is connected to the cDAQ, but the Analog Input block doesn't have this option (it only sees some other item from another USB port that I have my keyboard plugged into).
Here is what the NI Max program displays:
Thanks in advance for the help.


Manoj Mirge
Manoj Mirge 2023 年 3 月 20 日
Hi Kyle,
You can use Analog Input (Single Sample) block only with devices that support single sample acquisition. You can check whether your device support signal sample acquisition or not. If your device does not support signal sample acquisition, then you can’t use Analog Input (Single Sample) block for that device.
To acquire data from devices that do not support acquisition of a single sample (such as devices designed for sound and vibration), use the Analog Input block.
You can read more about Analog Input (Single Sample) block here.
Hope this helps.

その他の回答 (0 件)


Help Center および File ExchangeData Acquisition Toolbox についてさらに検索




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by