how to get current running time in a stateflow , ?

20 visualizaciones (últimos 30 días)
julyan he
julyan he el 6 de En. de 2017
Respondida: CognitiveBias el 7 de Mayo de 2019
with Matlab 2010b I just use " t" for cureeent time, but in higher version, this " t" never works
  3 comentarios
julyan he
julyan he el 6 de En. de 2017
this chart is running in matlab2010b, step = 0.5s, t0 t1 t2 tr is declared as local data, it works, however in matlab 2014 or 2016, i am warned to daclare t

Iniciar sesión para comentar.

Respuesta aceptada

Niels
Niels el 6 de En. de 2017
Editada: Niels el 6 de En. de 2017
if i did not missread u asked first for current time...
running time: tic toc
>> tic
x=1;
for i=1:10
x=x*i;
end
timeNeeded=toc
timeNeeded =
0.0099
current time clock
c=clock
c =
1.0e+03 *
2.0170 0.0010 0.0060 0.0130 0.0250 0.0237
>> fix(c)
ans =
2017 1 6 13 25 23
>> currentTime=(fix(c(4:6)))
currentTime =
13 25 23
  1 comentario
julyan he
julyan he el 6 de En. de 2017
It's my fault, in fact i'm asking the time from the moment the simulation begins, in 2010b, there is a default word "t" to express execution time, however in in higher version, "t" has no longer this function

Iniciar sesión para comentar.

Más respuestas (1)

CognitiveBias
CognitiveBias el 7 de Mayo de 2019
't' is a supported time symbol for C action language only.
For MATLAB action language use 'getSimulationTime()'.
getSimulationTime example.PNG

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by