MATLAB: Question about S function

level-2 s-functionsimulink

Hi,
Is it possible to realize the following with Level 2 S function?
The input is a binary data, that is, every time only one bit can be read. The output shall save up to 10 bit and give them out. In this case the sample times at the input and at the output are different.
The problem is, in S function "block.InputPort(1).Data" is only valid for the current sample time.
Thanks Senmeis

Best Answer

You need to create DWork vectors for the S-function to store all previous inputs.