Reads analog input data from a binary file, and stores the values in an array.
Member of the DataLogger class.
VB .NET
Public Function ReadAIChannels(ByVal startSample As Integer, ByVal count Integer, ByRef aiChannels As Single) As MccDaq.ErrorInfo
C# .NET
public MccDaq.ErrorInfo ReadAIChannels(int startSample, int count, ref float [] aiChannels)
startSample
The first sample to read from the binary file.
count
The number of samples to read from the binary file.
aiChannels
Receives the analog input values.
The user is responsible for allocating the size of the analog data array, and ensuring that it is large enough to hold the data that will be returned. You can calculate the array allocation using the sampleCount value from GetSampleInfo(), and the aiCount value from GetAIInfo():
float* aiChannels = new float[sampleCount * aiCount];
The figure below shows the layout of the analog array, and how the elements should be indexed.
Where:
n is (numberOfChannels – 1).
CH0 – CHn refer to the channels in the array, not the input channels of the device.
For example, assume that all of the even number input channels are logged. The analog array channels are mapped as shown here:
Array Channel | Device Input Channel |
0 | 0 |
1 | 2 |
2 | 4 |
3 | 6 |
Use the following code fragment to access the elements of the analog array:
for (i=0; i<numberOfSamples; i++)
{
for (j=0; j<numberOfAIChannels; j++)
{
a = analogArray[(i *numberOfAIChannels) + j];
}
}
where
numberOfSamples is set by the sampleCount value from GetSampleInfo()
numberOfAIChannels is set by the aiCount value from GetAIChannelCount()