%% Discover Available Devices
% Discover devices connected to your system using |daqlist|. To learn more
% about an individual device, access the entry in the device table.
d = daqlist("mcc");
d(1, :)
%% Create a DataAcquisition
% The |daq| function creates a DataAcquisition object. The DataAcquisition
% contains information describing hardware, scan rate, and other properties
% associated with the acquisition.
dq = daq("mcc")
%% Add an Analog Input Channel
% The |addinput| function attaches an input channel to the DataAcquisition.
% You can add more than one channel to a DataAcquisition.
%% Change Default Properties of the Acquisition
% By default, acquisitions run for one second at 1000 scans per second. To
% acquire at a different rate, change the |Rate| property.
dq.Rate = 100;
%%
% Run the acquisition and plot the acquired data:
[data, startTime] = read(dq, seconds(3));
hold on;
plot(data.Time, data.Board0_Ai5);
plot(data.Time, data.Board0_Ai6);
hold off;
xlabel("Time (s)");
ylabel("Voltage (V)");
Question
isherer
We're seeing a different value in Matlab than we are in DAQami.
My versions:
Windows 10
Instacal 6.60
Matlab 2024a
Data Acquisition Toolbox Support Package for Measurement Computing Hardware 24.1
We expect about 6 V and 0.5-0.9 Volts
DAQami is reading thosevalues correctly, but MATLAB when using slightly modified script of the example script at https://www.mathworks.com/help/daq/getting-started-with-session-based-interface-using-mcc-devices.html
we get these followings results where it starts at the correct values but then increases immediately to 10 V for both input channels. See attached graph.
%% Discover Available Devices
% Discover devices connected to your system using |daqlist|. To learn more
% about an individual device, access the entry in the device table.
d = daqlist("mcc");
d(1, :)
%% Create a DataAcquisition
% The |daq| function creates a DataAcquisition object. The DataAcquisition
% contains information describing hardware, scan rate, and other properties
% associated with the acquisition.
dq = daq("mcc")
%% Add an Analog Input Channel
% The |addinput| function attaches an input channel to the DataAcquisition.
% You can add more than one channel to a DataAcquisition.
addinput(dq, "Board0", "Ai5", "Voltage");
addinput(dq, "Board0", "Ai6", "Voltage");
dq
%% Change Default Properties of the Acquisition
% By default, acquisitions run for one second at 1000 scans per second. To
% acquire at a different rate, change the |Rate| property.
dq.Rate = 100;
%%
% Run the acquisition and plot the acquired data:
[data, startTime] = read(dq, seconds(3));
hold on;
plot(data.Time, data.Board0_Ai5);
plot(data.Time, data.Board0_Ai6);
hold off;
xlabel("Time (s)");
ylabel("Voltage (V)");
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now