Sample time of the model is 0.001sec but the Matlab function that I am using is with 2sec. I wanted to run particular code inside the Matlab function whenever the trigger input value becomes 1. When the trigger input value becomes 0, I want the outports of this Matlab function to retain the last known value. I am not able to use the trigger type subsystem as the Matlab function inside it runs at different sample time.
Now either I have to use both triggered and different sample time here or i should get a way to retain the last known value. Can anyone help me on this.
below is the format that i am using now.
function [out] = fcn(in)
if(in == 1)
out = 1;
% does nothing but during this part of execution, I want the variable out to retain its last known value (also as the variable out is not used in this path of execution but only in if statement, matlab throws an error.