isreadable.m

来自「这是一个关于MATLAB的函数」· M 代码 · 共 39 行

M
39 行
字号
function bool = isreadable(r, channelName)
%ISREADABLE Check if specified RDTX(tm) channel is readable.
%   ISREADABLE(R, CHANNEL) returns a Boolean value signifying whether an RTDX 
%   channel specified by the string CHANNEL, and as defined in the RTDX object 
%   R, is configured for 'read' operation.
%

% Copyright 2001-2002 The MathWorks, Inc.
% $Revision: 1.12 $ $Date: 2002/06/12 15:30:18 $

error(nargchk(2,2,nargin))

if ~exist('r'),
	error('Specified RTDX object does not exist.');
end

if ~ischar(channelName),
	error('Channel name must be a character string.');
elseif isempty(channelName),
	error('Channel name cannot be an empty string.');
end

% Check if the channelName is an existing open channel
chID=strmatch(channelName, {r.RtdxChannel{:,1}}, 'exact');
if isempty(chID),
    error('Specified channel is not open.');
end

if strcmpi(r.RtdxChannel{chID, 3},'r'),
    bool = logical(1);
elseif strcmpi(r.RtdxChannel{chID, 3},'w'),
    bool = logical(0);
else
    error('Specified channel is not properly initialized.');
end

% [EOF] isreadable.m

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?