Code covered by the BSD License  

Highlights from
Counter Example

from Counter Example by Scott Hirsch
An example using generic dll calling to use the counter on an NI daq card.

GPCTR_Watch(varargin)
function varargout = GPCTR_Watch(varargin)
%GPCTR_WATCH calls NI library with the appropriate arguments.
%
% The C declaration for this function is the following:
%	  extern i16 _stdcall GPCTR_Watch ( i16 deviceNumber, u32 gpCounterNumber, u32 watchID, u32 * watchValue); 
%
% The MATLAB Declaration looks like the following:
%	[int16, uint32Ptr] GPCTR_Watch(int16, uint32, uint32, uint32Ptr)
%
% This function will call loadlibrary on the library if needed.
% This file is automatically generated by the loadlibrarygui.
%
%   See also
%   LOADLIBRARY, UNLOADLIBRARY, LOADNI, UNLOADNI

% Copyright 2002-2004 The MathWorks, Inc
%
%
% $Author: $
% $Revision: $
% $Date: 12-Feb-2004 10:05:04 $
%
% Local Functions Defined:
%
%
% $Notes:
%
%
%
%
% $EndNotes
%
% $Description:
%
%
%
%
% $EndDescription


if nargin==0;
	help(mfilename);
	return;
end;


% If Library is loaded already unload it.

if ~libisloaded('NI')
	loadNI;
end;


if nargin~=4;
	error(mfilename:WrongNumberIn,'Incorrect number of input arguments.');
end;

if nargout~=1;
	error(mfilename:WrongNumberOut,'Incorrect number of output arguments.');
end;

% Call external function in loaded DLL.
[varargout{1}]=calllib('NI','GPCTR_Watch',varargin{:});

Contact us at files@mathworks.com