how define a variable that increment by Simulink time

9 views (last 30 days)
I am using Simulink in my system implementation. I have a matrix of size(1,500)as an input and need to output one row each time. As you can see in the attachment, How can I have one row of my .mat file per time.

Accepted Answer

Birdman
Birdman on 11 Nov 2017
Edited: Birdman on 11 Nov 2017
In this type of situations, what you need to do is to use a mat file which has a size of nx2, in this case n=500. The first column should consist of time vector of simulation time and it should be same size with your second column. The second column should contain your data. I also suggest you to work in discrete time where you input data from workspace.
For instance, since your data has a size of 500, if your simulation time is 10 seconds, your sampling(Step size) should be 10/500= 0.02. By this, you can form your first column(time vector) like
0:0.02:10
Note that this will form 501x1 column, so make sure that your second column also contains 501 elements.
To sum up, create a 501x2 array which contains
array=[time data];
Then give this as input from From Workspace block. Hope this is helpful for you.

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!