How to increment real world time in matlab function block of simulink?

1 view (last 30 days)
abc NP
abc NP on 2 Apr 2015
Commented: abc NP on 7 Apr 2015
Hi, I want to advance the complete system for n clk cycles or n samples(discrete constant sample period). Can I do this in matlab function block in simulink (simulink -> usr-defined-functions -> matlab function). Is this possible in matlab and simulink ?

Answers (1)

Denis Gurchenkov
Denis Gurchenkov on 7 Apr 2015
I don't think there is a way to "fast forward" the simulation time. However, you can achieve nearly same result by placing your blocks into a conditionally executed subsystem, and configure it so that the subsystem is not executed for the next N samples. Would this work for you?
  1 Comment
abc NP
abc NP on 7 Apr 2015
Hi Denis, Now my quest changed in another way. I have a huge model, where I want to change inputs (and observe outputs) to that model dynamically every time-sample/time-step. Now, even changing that for so many times is also time-consuming and I want to reuse these changes. So I want to run simulink in command line using "sim" command. The funniest thing here is that the matlab command line is running the entire model at once for all time steps, and even if I give stopTime in sim command, later its not resuming from where it ended but starting simulation from the beginning. This is really very small functionality and makes a huge difference to the real time digital world. Can you please help me with these, or if there is no solution to this can you please recommend matlab in the next release to add the functionality to the command line. I have seen some solutions, but none of them works properly. For example, I saw a code in this link (<>, but it is not working. Could you please help with this.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by