Connecting to NI cDAQ 9133 controller

1 回表示 (過去 30 日間)
Eric Freeman
Eric Freeman 2016 年 5 月 31 日
回答済み: Anshuman 2024 年 8 月 21 日
Is it possible to connect to a NI remote system (cDAQ 9133) through MATLAB? getDevices returns no connected devices.
  1 件のコメント
Khanh Pham
Khanh Pham 2024 年 7 月 24 日
Hi Eric,
Do you have a solution for this problem?

サインインしてコメントする。

回答 (1 件)

Anshuman
Anshuman 2024 年 8 月 21 日
The 'getDevices' function in MATLAB typically lists devices connected directly to your computer, so it won't automatically detect remote systems. Here’s how you can connect to a remote NI cDAQ system:
Make sure you have the MATLAB Data Acquisition Toolbox and NI-DAQmx driver installed on your system.
  1. Use the Data Acquisition Toolbox to create a session and specify the vendor as 'ni'. Here's an example:
% Create a session
s = daq.createSession('ni');
2. Use 'addAnalogInputChannel', 'addAnalogOutputChannel', or similar functions to add channels to your session. You will need the device ID, which you can find in NI MAX.
% Example of adding an analog input channel
% Replace 'cDAQ1Mod1' and 'ai0' with your actual device and channel IDs
ch = addAnalogInputChannel(s, 'cDAQ1Mod1', 'ai0', 'Voltage');
% Use startForeground or startBackground to acquire data.
data = s.startForeground();
% inspect the results
disp(data);
Hope this helps!

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by