• 0

Matlab Waveforms Sdk


The MatLab DAQ toolbox support for Analog Discovery offers limited functionality, but the underlying WaveForms SDK functions can be accessed too.


For manual and examples in Python and C++ see the SDK located in the default Windows installation path:

- 32bit C:Program FilesDigilentWaveFormsSDK

- 64bit C:Program Files (x86)DigilentWaveFormsSDK

function DWFtest();

% 32 bit system
%hfile = 'C:Program FilesDigilentWaveFormsSDKincdwf.h';
%64 bit system
hfile = 'C:Program Files (x86)DigilentWaveFormsSDKincdwf.h';

display(['Set variable hfile: ' hfile]);

if ~libisloaded('dwf')
    loadlibrary('dwf', hfile);

islibloaded = libisloaded('dwf');
fprintf('Check if dwf library is loaded: islibloaded = %dn',islibloaded)

% This is necessary to get the character strings
pBuffer = libpointer('int8Ptr',zeros(32,1));

display(['Version: ' char(pBuffer.Value')]);

%Just opening and making sure the device is in a known state
phdwf = libpointer('int32Ptr',0);
display(['FDwfDeviceOpen returned: ' num2str(phdwf.Value)])

% Close device and unload library
if phdwf.Value > 0

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I don't have too much MatLab experience either. I don't even have it installed at the moment.


Looking at the documentation the function calling and data passing should look like this:


% opened device id
hdwf = phdwf.Value;

% set parameter
calllib('dwf', 'FDwfAnalogInFrequencySet', hdwf, double(20000000.0))

% configure and start scope acquisition
calllib('dwf', 'FDwfAnalogInConfigure', hdwf, 0, 1)

% wait to finish
pstate = libpointer('int8Ptr',0);
while true
	calllib('dwf', 'FDwfAnalogInStatus', hdwf, pstate)
	if pstate.Value == 2 % Done; break; end

pData = libpointer('doublePtr', zeros(1,8192));
% get the acquired samples for first channel (0)
calllib('dwf', 'FDwfAnalogInStatusData', hdwf, 0, pData, 8192)

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now