I am facing a problem using the data imported into the workspace for my Simulink blocks.
My Case:
I did a simple block diagram to simulate the results before implementing this method to the actual Simulink blocks. I made use of a 'From workspace' block to read in the data and a scope to observe the output. These are the settings:
t=0:22/565:22
a.time=t
a.signals.values=ddata %ddata contains [565x1] datas
a.signals.dimensions=1;
I realized that the results in the scope doesn't match the data.
I found out that on this website (http://blogs.mathworks.com/seth/2012/02/09/using-discrete-data-as-an-input-to-your-simulink-model/) the steps taken by the Simulink solver are different from the ones specified in the input time vector.
Attempt to solve:
I set the time vector to zero but there is an error.
a.time=[];
Error: "Invalid continuous sample time specified for'test/From Workspace'. Continuous sample time is not permitted when the input from workspace is a structure with no time data. To eliminate this error, select a discrete sample time or change the input data to include time data. "
Questions:
How do I resolve this error without using time vector?
What is the best way to read one row for each time step into the Simulink block instead of a whole list of data?
I greatly appreciate if anybody can provide insight/solutions/alternative method to my case.
FixedStepDiscrete
, which may well fix your problem. – wakjah