To read data from NI-DAQ in MATLAB, you can use the daq.createSession
function to create a session object and configure the data acquisition channels. Here, you should pass the installed driver name as an input parameter. If you are not sure about the driver name, you can check it in the device manager.
main.m281 chars11 lines
In the above code, we are creating a session object with the NI driver installed on the system, adding an analog input channel, setting the sampling rate and duration of acquisition to acquire a signal for 1 second.
We then start the acquisition using the startForeground
function, which returns the acquired data and time.
Note: In the addAnalogInputChannel function, 'Dev1' is the device name/ID and 0 is the channel number. Change the device name and channel number according to your DAQ configuration.
gistlibby LogSnag