Specifications
OWNER’S GUIDE SOFTWARE | 9251
Using DWDataReader Library inside MATLAB™
The DWDataReader library (including many examples) is available for download free of charge. It can be
found on the www.dewamerica.com homepage on the DS-7 pages.
Because our library is a native DLL, depending on the programming language in use and its included interop
support, data types have to be converted and memory allocated.
To make this easier for the end-user a number of examples are available for Win32 & Win64-bit MATLAB™
or C language, Win32 VBA and Linux C.
The MATLAB™ example includes 3 les, the MATLAB™ script, the library and the header le.
dw_data_reader.m
DWDataReaderLib.dll
DWDataReaderLib.h
The basic steps to access D7D data les are explained in the library’s documentation:
1. Call DWInit to initialize the dynamic link library
2. Call DWOpenDataFile to open DEWESoft data file (*.d7d)
3. Call DWGetChannelListCount to get the number of channels
4. Allocate the DWChannel structure then call DWGetChannelList to get channel list properties
5. Call DWGetScaledSamplesCount to get the number of all samples
6. Allocate memory (data and time_stamp) then call DWGetScaledSamples
7. Call DWCloseDataFile to close data file
8. Call DWDeInit to clear and close dynamic link library
Short walk-through of the example:
- Hint: The steps inside the demo are documented, so just look at the comments for more information.
64-bit operation mode is checked at rst.
Then the DLL is loaded into MATLAB™.
The steps above have to be followed for correct operation, so the next step is to init the library.
Get version is an optional step.
Structures and referring pointers are created to be used as return types later on.
The data le being opened is dened in line 41, default path is c:\Test.d7d.
[stat, le_name, info_data] = calllib(DWDataLibFile, ‘DWOpenDataFile’, ‘c:\Test.
d7d’, sptr.Value);
DWGetChannelListCount returns the number of channels inside the data le.
Events, such as start storing, are checked with DWGetEventListCount and DWGetEventListItem
All data channels are then looped through and parameters such as name and color are read with