MATLAB: Inport in Simulink Doesn’t Hold Last Value

inputinterpolationsimulink

I am running a model, and I have set 'LoadExternalInput' to 'on' for the simulation. I set my top-level inport's 'Interpolate' option to 'off'. My respective input signal is a constant, so I have it saved as a structure with time, so time is 0, and my signals.values is 1 (or whatever it needs to be, but is nonzero). I notice that for the first time sample, the value is indeed what is expected, but after that goes to zero. Is there anyway to set it so that it hold the last value instead of returning to 0? I'm running 2010a.

Best Answer

I would recommend using the Constant block instead. Importing data via the Inport block requires you to give data in a prescribed format. In your case, the structure needs to contains a time vector and a value vector, where time goes from 0 to the simulation stop time. Specifying the value for t=0 is not sufficient.