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

📄 pgetiospec.m

📁 利用Stateflow 进行嵌入式代码开发很好用
💻 M
字号:
function ioSpec = pGetIOSpec(ioInfo)
%PGETIOSPEC Returns a structure containing information on the function IO
%   specification.
%

%   Copyright 2005 The MathWorks, Inc.
%   $File: $
%   $Revision: $
%   $Date:  $

ioSpec.u = [];
ioSpec.y = [];
ioSpec.p = [];

% Transform the lhsIOinfo or rhsIOinfo cell arrays into an info struture.
% At this point, it's assumed that all checking on the inputs cell array
% have been done!!!
if isempty(ioInfo)
    return
end

ioSpec.u = iFillIOstruct(ioInfo, 'u');
ioSpec.y = iFillIOstruct(ioInfo, 'y');
ioSpec.p = iFillIOstruct(ioInfo, 'p');


%--------------------------------------------------------------------------
function oStruct = iFillIOstruct(ioInfo, token)
% Internal function

% Initialize the output structure
initStruct = struct(...
    'Qualifier',    '',... % not used actually 
    'DataTypeName', '',... % data type
    'Dimensions',   [],... % dimensions
    'AccessType',   [],... % 0 if not accessed by pointer, 1 otherwise
    'Expression',   ''...  % original expression in the fcn specification
    );

% If token not found then return
idx = find(strcmp(ioInfo(:,1), token));
if isempty(idx)
    oStruct = [];
    return
end

% Extract only info concerning token and remove duplicated info
ioInfo = ioInfo(idx,:);
portNum = cell2mat(ioInfo(:,2));
[num, idx] = unique(portNum);
ioInfo = ioInfo(idx,:);

nbElement = length(idx);

% Allocate output structure
oStruct(1:nbElement) = initStruct;

% Fill the output structure
for ii = 1:nbElement
    oStruct(ii).DataTypeName = ioInfo{ii, 3};
    oStruct(ii).Dimensions   = ioInfo{ii, 4};
    oStruct(ii).AccessType   = ioInfo{ii, 5};
    oStruct(ii).Expression   = ioInfo{ii, 6};    
end


⌨️ 快捷键说明

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