⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 read_string.m

📁 这是一个关于MATLAB的函数
💻 M
字号:
function resp = read_string(nn,index,timeout)
% Copyright 2002 The MathWorks, Inc.
%   $Revision: 1.5 $  $Date: 2002/05/15 14:57:48 $

error(nargchk(1,3,nargin));
if ~ishandle(nn),
    error('First Parameter must be a STRING Handle.');
end

if nargin == 1,
    resp = read_numeric(nn);
elseif nargin == 2,
    resp = read_numeric(nn,index);     
else
    resp = read_numeric(nn,index,timeout);
end

nullfound = find(resp==0);
if ~isempty(nullfound)
    resp = resp(1:nullfound(1));
elseif isempty(nullfound) & prod(nn.size)~=1
    warning('Character array does not end with a NULL character');
end

resp = checkforNonASCII(resp);
resp = equivalent(nn,resp);

%-----------------------------------
function resp = checkforNonASCII(resp)
if any(resp<0) | any(resp>127)
    warning('Non-ASCII characters in the result are saturated. Use READNUMERIC to get the exact numeric values ');
    % Saturate
    idx = find(resp<0);     resp(idx) = 0;
    idx = find(resp>127);   resp(idx) = 127;
end

% [EOF] read_string.m

⌨️ 快捷键说明

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