function obj = instrument(validname)
%INSTRUMENT Construct instrument object.
%
%    INSTRUMENT is the base class from which serial port objects  
%    are derived from.
% 
%    See also SERIAL.
%

%    MP 7-13-99
%    Copyright 1999-2000 The MathWorks, Inc. 
%    $Revision: 1.5 $  $Date: 2000/08/29 23:47:10 $

% Determine if called directly or from constructor.
if (nargin == 0 | ~any(strcmp(validname, {'serial', 'gpib', 'visa'})))
    % The instrument constructor was called directly.
    if isempty(which('gpib'))
    	error('An instrument object is instantiated through the SERIAL constructor.');    
    else
    	error('An instrument object is instantiated through the SERIAL, GPIB or VISA constructor.')
    end
end

% Error if java is not running.
if ~usejava('jvm')
    error('The instrument object requires JAVA support.');
end

obj.store = {};
obj = class(obj, 'instrument');