Data Acquisition Toolbox Support Package for Digilent Analog Discovery hardware (R2012a / R2012b)

by

 

02 Oct 2012 (Updated )

Analog Input/Output (foreground clocked/non-clocked) support for Digilent Analog Discovery.

daq.di.utility.throwOrWarnOnStatus( digilentStatusCode )
function throwOrWarnOnStatus( digilentStatusCode )
%THROWORWARNONSTATUS Throw an error or fire a warning based on Digilent status
%
%    This undocumented function may be removed in a future release.

% Copyright 2010-2012 The MathWorks, Inc.

    if digilentStatusCode == daq.di.Session.APIConstant_Success
        return
    end
    
    % Since a bool is returned, retrieve the last error message from the
    % driver and inform the user
    try
    [status,errorMessage] = daq.di.dwf.FDwfGetLastErrorMsg(blanks(512));
    [status, errorCode  ] = daq.di.dwf.FDwfGetLastError(int32(0));
    catch e
        rethrow(e)
    end
    
        errorToThrow = MException(sprintf('daq:digilent:err%d',  errorCode),...
            'Digilent Error %d:\n%s', errorCode,errorMessage);
        throwAsCaller(errorToThrow);    
   

end

Contact us