readbin.m

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

M
46 行
字号
function resp = readbin(mm,index,timeout)
%READ2BIN Retrieves a block of DSP memory as hexadecimal strings.
%   DN = READ2BIN(MM)
%   DN = READ2BIN(MM,[],TIMEOUT) - reads a 
%
%
%   DN = READ2BIN(MM,INDEX)
%   DN = READ2BIN(MM,INDEX,TIMEOUT) - reads a ?
%
%   HS = READ2BIN(MM) - returns a binary string representation of 
%   the DSP's numeric values.  For arrays, the returned values will 
%   be a cell array of binary strings.  Conversely, if MM.SIZE equals 1,
%   (indicating a scalar), the output is an array of hex characters. 
%
%   DN = READ2BIN(MM,TIMEOUT) - The time alloted to perform the read is 
%   limited  by the MM.TIMEOUT property of the MM object.  However, 
%   this method can be used to explicitly define a different timeout
%   for the read.  For example, this may be necessary for very large 
%   data transfers.
%  
%   See also WRITE, READ, CAST, NUMERICMEM.

%   Copyright 2002 The MathWorks, Inc.
%   $Revision: 1.8 $ $Date: 2002/04/03 19:37:23 $

error(nargchk(1,3,nargin));
if ~ishandle(mm),
    error('First Parameter must be a MEMORYOBJ Handle.');
end
if nargin == 1,
    uidata = read_memoryobj(mm);
elseif nargin == 2,
    uidata = read_memoryobj(mm,index);     
else
    uidata = read_memoryobj(mm,index,timeout);
end
neleminuidata = prod(size(uidata));

if uidata == 1,
    resp = dec2bin(double(uidata),mm.bitsperstorageunit);
else % create cell array TBD
   resp = dec2bin(double(uidata),mm.bitsperstorageunit);
end

% [EOF] readbin.m

⌨️ 快捷键说明

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