convert.m

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

M
58 行
字号
function re = convert(re,datatype,size)
% CONVERT - Convert RE representation into DATATYPE and 
% optionally reshape it to SIZE.
%
%   Copyright 2002 The MathWorks, Inc.
%   $Revision: 1.3 $  $Date: 2002/03/29 22:50:10 $

nargchk(2,3,nargin);
if ~ishandle(re),
    error('First Parameter must be a RENUM Handle.');
end

if strcmp(re.procsubfamily(1:2),'C6')

    if isempty( strmatch(datatype,      ...
		{   'uint8',        'int8',     ...
            'uint16',       'int16',    ...
            'int64',        'uint64',   ...
		    'char',         'unsigned char',    'signed char',  ...
            'short',        'unsigned short',   'signed short', ...
		    'long',         'unsigned long',    'signed long',  ...
		    'double',       'long double',      'long long'     ...
		},  'exact') ),
    
       if nargin==2
           convert_rnumeric(re,datatype);
       else
           convert_rnumeric(re,datatype,size);
       end
	else
        error('An enum cannot have a non-32 bit datatype.');
	end
    
elseif strcmp(re.procsubfamily,'C54x')
    
	if isempty( strmatch(datatype, ...
		{   'uint8',        'int8',     ...
            'int32',        'uint32',   ...
            'int64',        'uint64',   ...
		    'long',         'unsigned long',    'signed long',  ...
		    'float',        ...
            'double',       'long double',      'long long'...
		},  'exact') ),
    
       if nargin==2
           convert_rnumeric(re,datatype);
       else
           convert_rnumeric(re,datatype,size);
       end
	else
        error('An enum cannot have a non-16 bit datatype.');
	end
    
end

% [EOF] convert.m

⌨️ 快捷键说明

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