MATLAB: How to hold the extrapolated values using time series object

simulink

I am not able to hold the last known value of the data point between Simulation time?

Best Answer

In order to hold the last value during simulation, the customer needs to use the setinterpmethod to "zero-order hold" in case of data import (either from excel file or to signal builder). The sample code for setInterpmethod is given below:
>> ts = timeseries(rand(100,1),1:100);
>> ts = setinterpmethod(ts,'zoh');
Save the above data in MAT file and use this to import data into the Signal builder. This will make sure that the last value is held in the plot during the sample time period.
Please note that when using a From Workspace block to get the timeseries data into Simulink, you will need to Turn-off the option "Interpolate Data".