DCOM with Matlab
Dear Dewesoft team,
I hope you’ll be able to help me. I’m contacting you regarding a difficulty I have when I want to get the sample rate related to a dxd file.
When I run this code, sometimes I get the sample rate value without any issue but most of the times I get a sample rate value equal to 0…
This success is completely random and I really don’t understand why.
My program is the following one:
if (strcmp(computer, 'PCWIN64') == 1 || strcmp(computer, 'GLNXA64') == 1)
DWDataLibFile = 'DWDataReaderLib64';
else
DWDataLibFile = 'DWDataReaderLib';
end;
% load dll with header file
if(ispc)
loadlibrary([DWDataLibFile, '.dll'], 'DWDataReaderLib.h');
else
loadlibrary([DWDataLibFile, '.so'], 'DWDataReaderLib.h');
end;
% list of all the used functions
libfunctions(DWDataLibFile);
% intiate the DATA reader
calllib(DWDataLibFile, 'DWInit');
% take the dll version
ver = calllib(DWDataLibFile, 'DWGetVersion');
disp(sprintf('Dll version: %d', ver));
% create sctructures to pass to dll functions
str = libstruct('DWFileInfo');
sptr = libpointer('DWFileInfo', str);
% createa structure
str2 = libstruct('DWChannel');
sptr2 = libpointer('DWChannel', str2);
% Open the recoder file : testAA.dxd
[stat, file_name, info_data] = calllib(DWDataLibFile, 'DWOpenDataFile', 'testAA.dxd', sptr.Value);
disp(sprintf('Sample rate: %d', info_data.sample_rate));
samplerate=info_data.sample_rate;
disp(sprintf('Start store time: %d', info_data.start_store_time));
disp(sprintf('File duration: %d', info_data.duration));
% read the number of channels in Dewesoft
[channel_count] = calllib(DWDataLibFile, 'DWGetChannelListCount');
disp(sprintf('Number of channels: %d', channel_count));*
Please don’t hesitate to contact me if you need any further detail !
Thank you in advance for your help and answer,
Kind regards,
Technical support
Hi,
just looking at the code, I think there aren't any apparent issues. If you say that the same code sometimes produces the correct result and sometimes doesn't, then my guess is that the data files that you're trying to read are what's changing. Some of them are compatible with your code and others are not. With the release of X3, Dewesoft's data file structure has changed a bit. My guess is that you're able to correctly read the old data files while the new data files produce invalid results.
If that's true, then you'd only need to download the latest version of the DWDataReader from the developers section and swap out the dlls.
Please try this out and let me know whether the results of your application will change.