Causes of Reference to non-existent field 'SetPreCompInpPortInfoToDynamic' ?

  • Follow


Hi,

I am trying to write a state machine, I am getting the error
??? Input argument "block" is undefined.
Error in ==> equalstestb at 19
setup(block);
??? Reference to non-existent field 'SetPreCompInpPortInfoToDynamic'.

The attached is the start of my m-file,  what is the usuall cause of this error?

Thanks 



function equalstestb(block)
%equalstestb A template for a Leve-2 M-file S-function
%   The M-file S-function is written as a MATLAB function with the
%   same name as the S-function. Replace 'equalstestb' with the 
%   name of your S-function.
%
%   It should be noted that the M-file S-function is very similar
%   to Level-2 C-Mex S-functions. You should be able to get more
%   information for each of the block methods by referring to the
%   documentation for C-Mex S-functions.
%
%   Copyright 2003-2007 The MathWorks, Inc.

%%
%% The setup method is used to setup the basic attributes of the
%% S-function such as ports, parameters, etc. Do not add any other
%% calls to the main body of the function.
%%
setup(block);

%endfunction

%% Function: setup ===================================================
%% Abstract:
%%   Set up the S-function block's basic characteristics such as:
%%   - Input ports
%%   - Output ports
%%   - Dialog parameters
%%   - Options
%%
%%   Required         : Yes
%%   C-Mex counterpart: mdlInitializeSizes
%%
%%
function setup(block)

% Register number of ports
block.NumInputPorts  = 2;
block.NumOutputPorts = 3;

% Setup port properties to be inherited or dynamic
block.SetPreCompInpPortInfoToDynamic;
block.SetPreCompOutPortInfoToDynamic;



% Override input port properties
block.InputPort(1).Dimensions        = 1;
block.InputPort(1).DatatypeID  = 0;  % double
block.InputPort(1).Complexity  = 'Real';
block.InputPort(1).DirectFeedthrough = true;

block.InputPort(2).Dimensions        = 1; % input out of spec
block.InputPort(2).DatatypeID  = 0;  % double
block.InputPort(2).Complexity  = 'Boolean';
block.InputPort(2).DirectFeedthrough = true;

% Override output port properties
block.OutputPort(1).Dimensions       = 1;
block.OutputPort(1).DatatypeID  = 0; % double
block.OutputPort(1).Complexity  = 'Real';
block.OutputPort(2).Dimensions       = 1;
block.OutputPort(2).DatatypeID  = 0; % double
block.OutputPort(2).Complexity  = 'Real';
block.OutputPort(3).Dimensions       = 1;
block.OutputPort(3).DatatypeID  = 0; % double
block.OutputPort(3).Complexity  = 'Integer';


% Register parameters
block.NumDialogPrms     = 0;

% Register sample times
%  [0 offset]            : Continuous sample time
%  [positive_num offset] : Discrete sample time
%
%  [-1, 0]               : Inherited sample time
%  [-2, 0]               : Variable sample time
block.SampleTimes = [-1 0];

% Specify the block simStateComliance. The allowed values are:
%    'UnknownSimState', < The default setting; warn and assume DefaultSimState
%    'DefaultSimState', < Same sim state as a built-in block
%    'HasNoSimState',   < No sim state
%    'CustomSimState',  < Has GetSimState and SetSimState methods
%    'DisallowSimState' < Error out when saving or restoring the model sim state
block.SimStateCompliance = 'DefaultSimState';

%% -----------------------------------------------------------------
%% The M-file S-function uses an internal registry for all
%% block methods. You should register all relevant methods
%% (optional and required) as illustrated below. You may choose
%% any suitable name for the methods and implement these methods
%% as local functions within the same file. See comments
%% provided for each function for more information.
%% -----------------------------------------------------------------

block.RegBlockMethod('PostPropagationSetup',    @DoPostPropSetup);
block.RegBlockMethod('InitializeConditions', @InitializeConditions);
block.RegBlockMethod('Start', @Start);
block.RegBlockMethod('Outputs', @Outputs);     % Required
block.RegBlockMethod('Update', @Update);
block.RegBlockMethod('Derivatives', @Derivatives);
block.RegBlockMethod('Terminate', @Terminate); % Required
block.InputPort(1).SamplingMode = 'Sample'; 
block.InputPort(2).SamplingMode = 'Sample'; 


block.OutputPort(1).SamplingMode = 'Sample'; 
block.OutputPort(2).SamplingMode = 'Sample';
block.OutputPort(3).SamplingMode = 'Sample';

%block.RegBlockMethod('SetInputPortSamplingMode', @SetInpPortSamplingMode);

%end setup
0
Reply James 4/26/2010 3:56:04 PM

On Monday, April 26, 2010 11:56:04 AM UTC-4, James Salisbury wrote:
> Hi,
> 
> I am trying to write a state machine, I am getting the error
> ??? Input argument &quot;block&quot; is undefined.
> Error in ==&gt; equalstestb at 19
> setup(block);
> ??? Reference to non-existent field &#39;SetPreCompInpPortInfoToDynamic&#39;.
> 
> The attached is the start of my m-file,  what is the usuall cause of this error?
> 
> Thanks 
> 
> 
> 
> function equalstestb(block)
> %equalstestb A template for a Leve-2 M-file S-function
> %   The M-file S-function is written as a MATLAB function with the
> %   same name as the S-function. Replace &#39;equalstestb&#39; with the 
> %   name of your S-function.
> %
> %   It should be noted that the M-file S-function is very similar
> %   to Level-2 C-Mex S-functions. You should be able to get more
> %   information for each of the block methods by referring to the
> %   documentation for C-Mex S-functions.
> %
> %   Copyright 2003-2007 The MathWorks, Inc.
> 
> %%
> %% The setup method is used to setup the basic attributes of the
> %% S-function such as ports, parameters, etc. Do not add any other
> %% calls to the main body of the function.
> %%
> setup(block);
> 
> %endfunction
> 
> %% Function: setup ===================================================
> %% Abstract:
> %%   Set up the S-function block&#39;s basic characteristics such as:
> %%   - Input ports
> %%   - Output ports
> %%   - Dialog parameters
> %%   - Options
> %%
> %%   Required         : Yes
> %%   C-Mex counterpart: mdlInitializeSizes
> %%
> %%
> function setup(block)
> 
> % Register number of ports
> block.NumInputPorts  = 2;
> block.NumOutputPorts = 3;
> 
> % Setup port properties to be inherited or dynamic
> block.SetPreCompInpPortInfoToDynamic;
> block.SetPreCompOutPortInfoToDynamic;
> 
> 
> 
> % Override input port properties
> block.InputPort(1).Dimensions        = 1;
> block.InputPort(1).DatatypeID  = 0;  % double
> block.InputPort(1).Complexity  = &#39;Real&#39;;
> block.InputPort(1).DirectFeedthrough = true;
> 
> block.InputPort(2).Dimensions        = 1; % input out of spec
> block.InputPort(2).DatatypeID  = 0;  % double
> block.InputPort(2).Complexity  = &#39;Boolean&#39;;
> block.InputPort(2).DirectFeedthrough = true;
> 
> % Override output port properties
> block.OutputPort(1).Dimensions       = 1;
> block.OutputPort(1).DatatypeID  = 0; % double
> block.OutputPort(1).Complexity  = &#39;Real&#39;;
> block.OutputPort(2).Dimensions       = 1;
> block.OutputPort(2).DatatypeID  = 0; % double
> block.OutputPort(2).Complexity  = &#39;Real&#39;;
> block.OutputPort(3).Dimensions       = 1;
> block.OutputPort(3).DatatypeID  = 0; % double
> block.OutputPort(3).Complexity  = &#39;Integer&#39;;
> 
> 
> % Register parameters
> block.NumDialogPrms     = 0;
> 
> % Register sample times
> %  [0 offset]            : Continuous sample time
> %  [positive_num offset] : Discrete sample time
> %
> %  [-1, 0]               : Inherited sample time
> %  [-2, 0]               : Variable sample time
> block.SampleTimes = [-1 0];
> 
> % Specify the block simStateComliance. The allowed values are:
> %    &#39;UnknownSimState&#39;, &lt; The default setting; warn and assume DefaultSimState
> %    &#39;DefaultSimState&#39;, &lt; Same sim state as a built-in block
> %    &#39;HasNoSimState&#39;,   &lt; No sim state
> %    &#39;CustomSimState&#39;,  &lt; Has GetSimState and SetSimState methods
> %    &#39;DisallowSimState&#39; &lt; Error out when saving or restoring the model sim state
> block.SimStateCompliance = &#39;DefaultSimState&#39;;
> 
> %% -----------------------------------------------------------------
> %% The M-file S-function uses an internal registry for all
> %% block methods. You should register all relevant methods
> %% (optional and required) as illustrated below. You may choose
> %% any suitable name for the methods and implement these methods
> %% as local functions within the same file. See comments
> %% provided for each function for more information.
> %% -----------------------------------------------------------------
> 
> block.RegBlockMethod(&#39;PostPropagationSetup&#39;,    @DoPostPropSetup);
> block.RegBlockMethod(&#39;InitializeConditions&#39;, @InitializeConditions);
> block.RegBlockMethod(&#39;Start&#39;, @Start);
> block.RegBlockMethod(&#39;Outputs&#39;, @Outputs);     % Required
> block.RegBlockMethod(&#39;Update&#39;, @Update);
> block.RegBlockMethod(&#39;Derivatives&#39;, @Derivatives);
> block.RegBlockMethod(&#39;Terminate&#39;, @Terminate); % Required
> block.InputPort(1).SamplingMode = &#39;Sample&#39;; 
> block.InputPort(2).SamplingMode = &#39;Sample&#39;; 
> 
> 
> block.OutputPort(1).SamplingMode = &#39;Sample&#39;; 
> block.OutputPort(2).SamplingMode = &#39;Sample&#39;;
> block.OutputPort(3).SamplingMode = &#39;Sample&#39;;
> 
> %block.RegBlockMethod(&#39;SetInputPortSamplingMode&#39;, @SetInpPortSamplingMode);
> 
> %end setup

I got similar type of error while trying to run lvl 2 m-file s function.
??? Input argument "block" is undefined.

Error in ==> svpwm_states at 2
setup(block);

Have you found the solution?!
0
Reply bhumiin (1) 7/11/2012 11:05:13 PM


1 Replies
645 Views

(page loaded in 0.083 seconds)

Similiar Articles:













7/22/2012 2:32:07 AM


Reply: