Reads analog inputs
data = mdaqAIRead(channels, range, isDifferential)
This function returns immediately acquired values from MicroDAQ input channels as a 1-by-n array of doubles. The value is stored in data, where n is the number of input channels. The channels parameter can be a scalar or vector and it should contain channels numbers according to MicroDAQ hardware configuration. The range argument specifies channel measurement input range. Matrix n-by-2 where n is number of used channels shall be provided. If 1x2 matrix is provided, the range setting will be used for all channels. The isDifferential argument specifies measurement mode - differential or single-ended. This argument can be scalar or vector (if applicable for MicroDAQ hardware configuration). If scalar provided, its value will be used for all used channels.
channels: Scalar or vector with channels to be read
Analog input channel selection in differential mode:
range: Range matrix - single row matrix e.g. [-10,10] sets -10 to 10V input range which will be used for all channels. If multi-range used, row number must match selected channels e.g. range matrix for 3 channels [-10,10; -5,5; -2,2]
isDifferential: Scalar or vector with measurement mode settings: true - differential, false - single-ended mode
data: Values of acquired data
Read 8 single-ended channels with same channel input rage
data = mdaqAIRead(1:8, [-10,10], false); sprintf('Acquired data: %fV\t%fV\t%fV\t%fV\t%fV\t%fV\t%fV\t%fV \n', data)
Read 4 single-ended channels with different channel input rage
NOTE: Example will work if applicable for MicroDAQ analog input configuration
data = mdaqAIRead(1:4, [-10,10; -5,5; -5,5; -10,10], false); sprintf('Acquired data: %fV\t%fV\t%fV\t%fV\n', data)
Read 1 differential channel, 2 single-ended channels with different channel input rage
NOTE: Example will work if applicable for MicroDAQ analog input configuration
data = mdaqAIRead([1 3 4], [-10,10; -5,5; -10,10], [true false false]); sprintf('Acquired data: %fV\t%fV\t%fV\n', data)