Files
mocha/scripts/mcaegu.m
2017-09-19 11:58:36 +02:00

35 lines
1.3 KiB
Matlab

function varargout = mcaegu(varargin)
%MCAEGU - read engineering units from PV's
%
% VALUES = MCAEGU(HANDLE) returns a string array of enum strings of the
% PV specified by integer HANDLE.
% The function does not handle arrays of PV handles, but only a single PV at at time.
%
%
% Error handling:
% An empty cell string array will be returned if the PV type is not ENUM.
% A matlab exception will be thrown when the PV handle is invalid,
% i.e. not the result of a successful MCAOPEN.
% Furthermore, an error can result from a 'get' timeout,
% configurable via MCATIMEOUT.
% In addition, an error can result from a network disconnect.
% In principle, one can check beforehand via MCASTATE, but since
% a disconnect might happen just between the sucessful MCASTATE call
% and the following MCAGET, the only safe thing might be to surround
% MCAGET calls with TRY....CATCH.
%
% See also TRY, CATCH, MCASTATE, MCATIMEOUT, MCAPUT
if nargin<1
error('No arguments were specified in mcaget')
elseif nargin==1
if length(varargin{1})>1
error('Only single PV can be handled at a time')
else
pvCtrl=mocha('getCtrlCache', varargin{1});
varargout{1} = {pvCtrl.units}; %mca(41,varargin{1});
end
elseif nargin>1
error('Only single PV can be handled at a time')
end