1.1 Binary Data MATLAB Function
This function will import all the channel data files (.CHN) in a DTS test folder and output the data in unfiltered EU. The EU data will be zeroed based on the zero method selected for the channel in SLICEWare or DataPRO.
When executed, the function will present the user with a ‘select folder’ dialog. The user will then choose the DTS test folder and the function will open the .DTS file in that folder and begin to collect information about proportionality, excitation values, inversion, initial EU, and zeroing method. Then the function will begin to iterate through all the .CHN files in that folder. The header information from the .CHN files includes the mV per ADC value, the mV/EU or mV/V/EU value, and the offset in ADC. This data along with the aforemented data from the .DTS file is used to scale and offset the raw ADC values that are read from the .CHN file to convert to Engineering Units. Once the iteration of all .CHN files is complete, the data is output in an array (npnts, nchan) along with the sample rate and path name.
Download the .m file at the bottom of this post.
1.2 Function Definition
[data, sampleRate, path, channelInfoMetadata, timeOfFirstSamples, ADC] = read_dts_folder;
- Will contain the EU data from the folder selected by the dialog in the form (number of points, number of channels)
- To access the first channel in the array the user would use:
- Will contain the sample rate for the test
- Will contain the path of the test
- Will contain SerialNumber, Description, and EU for each channel of the test
- Will contain an array of Time in seconds of the first Sample for each channel of the test
- Will contain ADC data
1.2 Function Example
The following code sample will execute read_dts_folder and plot the first channel.
[data, Fs, pn, channelInfoMetadata, timeOfFirstSamples, dataADC] = read_dts_folder;
Y = data(:,chIndex);
t = linspace(timeOfFirstSamples(chIndex),(length(data)/Fs)+timeOfFirstSamples(chIndex),length(data));