MATLAB: Simevents discrete-event system documentation does not include some of variable-input syntaxes

matlab discrete-event systemSimEventsvariable inputs

I noticed that in this example, the WheelEntry method invokes an eventIterate action with just 2 inputs and works just fine, but the documentation page of eventIterate just mentions the syntax with 3 inputs. Is there a general rule for distinguishing the optional inputs of event action functions?

Best Answer

  • Hi Kar,
    Unfortunately, to my knowledge, there isn't an easy way to infer the optional arguments. However, the way I infer the optional arguments is to open the base class file 'DiscreteEventSystem.m' and look at the definitions there. So in this case I see the following:
    function event = eventIterate(storageId, tag, varargin)
    % Define an event to iterate entities of a storage
    event = matlab.DiscreteEventSystem.newEvent();
    event.type = 'iterate'; = storageId;
    event.tag = tag;
    nVarargs = length(varargin);
    if nVarargs == 0
    elseif nVarargs == 1
    event.priority = varargin{1};
    So it seems like storageId and tag are mandatory inputs, while priority is optional. I wish the documentation mentioned this.
    Warm regards,