title: Simulink - Output 1 every 30 seconds, 0 otherwise
body: <p>I need a subsystem that needs to output 1 at interval or 30 seconds or slightly over 30 seconds. </p>
  
  <p>Written in matlab code it should work like that</p>
  
  <pre><code>function y = fcn(time,uplinkTimeInterval)
  
  %#codegen
  
  persistent lastTriggerTime
  
  if isempty(lastTriggerTime)
  
      lastTriggerTime = 0;
  
  end 
  
  if time&gt;=lastTriggerTime || time == 0
  
      y = 1;
  
      lastTriggerTime = time + uplinkTimeInterval;
  else
  
      y = 0;
  
  end
  
  end
  </code></pre>
  
  <p>where ulplinkTimeInterval is 30 seconds. Of course I tried to use the matlab function block with this code but for some reason it does not work (in debug mode I can see that y takes value 1 as it should but it simply does not ouput the value outside the block), therefore I wanted to use blocks but I do not know how to do it.</p>
  
  <p>Thanks very much for your help </p>