MATLAB Answers

How can I stop the recompile of the model after first run to quicken the simulation time ?

1 view (last 30 days)
Karim Gamal
Karim Gamal on 10 May 2020
Answered: Mark McBroom on 14 May 2020
I am making a game using unity and I have a simulink model that recieves cooridinates and sends data from which the unity "player" moves. and as figures this needs simulink to be very quick in simulating the model and giving the output so that it can nearly sync with unity.. but the problem is simulink simulation is slow..
I update parameters using set_param then use sim function to run the simulation with the new parameters but each time takes around 2.5 3 secs which causes a response delay to unity thus incorrect/delayed motion in unity.
I tried using model reference and running the model in accelerator mode which seemed to cause the same issue..
so is there any possible way to eliminate this delay.. it should be atleast less than a second to make the motion the least good.
here's the part responsible in my matlab code:

  0 Comments

Sign in to comment.

Answers (1)

Mark McBroom
Mark McBroom on 14 May 2020
  1. make the parameters for INputX and InputY to be tunable workspace parameters. https://www.mathworks.com/help/xpc/ug/tuning-block-parameters-and-model-parameters.html
3. Alternately, you should be able to switch model to accelerated mode, and it should not recompile model when you change the tunable parameter.

  0 Comments

Sign in to comment.

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by