Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation



06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

function usbtc08disconnect(tc08Handle)
% USBTC08DISCONNECT disconnects the USB TC-08 from MATLAB
% usbtc08disconnect(tc08Handle) disconnects the USB TC-08 from MATLAB and
% unloads the dlls, where tc08Handle is an integer from 1-255 supplied by
% usbtc08connect.

% number of arguments error check
error(nargchk(1, 1, nargin))

% initialises variables for convenience
tc08LibraryName = 'usbtc08';
tc08Call = 'usb_tc08';

% error handling
if ~isnumeric(tc08Handle) || ~isscalar(tc08Handle) || tc08Handle ~= uint8(tc08Handle) || ~tc08Handle
    % errors
    error('handle must be an unsigned integer from 1 to 255')
elseif ~libisloaded(tc08LibraryName)
    % errors
    error('dll is not loaded - TC-08 is not currently connected anyway')

% closes communication with TC-08
calllib(tc08LibraryName, [tc08Call, '_close_unit'], tc08Handle);

% unloads library from memory

Contact us