Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

how to put simulink model inside a function,which will be called every one second

Asked by Arun Badigannavar on 20 Dec 2012

I am trying to implement a simulink model inside function,,where this function is called every one second (using timer in script),and update stop time of the model 1 second each,,,How to do this?

1 Comment

Arun Badigannavar on 20 Dec 2012
t = timer('TimerFcn','launch','StartDelay',1);
start(t)
stat=1;
while(true)
 % set_param(gcs,'StopTime','inf'
set_param(gcs,'StopTime', sprintf('%d',t));
% set_param(gcs,'StopTime', '10');
set_param(gcs,'Simulationcommand','start')
%  pause(1)
% set_param(gcs,'Simulationcommand','pause')
%  pause(0.00001)
set_param(gcs,'Simulationcommand','update')
set_param(gcs','Simulationcommand','continue')
% [columns,rows] =  size(x_T)
% answer=x_T(columns,rows)
end
if true
  % code
end

This is my code

Arun Badigannavar

Products

No products are associated with this question.

0 Answers

Contact us