Borrar filtros
Borrar filtros

how to start time from 0s

4 visualizaciones (últimos 30 días)
mira
mira el 5 de Abr. de 2015
Editada: Stephen23 el 6 de Abr. de 2015
Hi, I am creating a GUI in matlab. I have a button and the time when I press the button is recorded. I manage to do that using clock. However, is there any way the start of the time is from 0s? Thanks.
  1 comentario
Jan
Jan el 5 de Abr. de 2015
Please edit the question and add much more details. "Using clock" does not explain clearly, what you are doing, therefore I cannot guess what the problem is.

Iniciar sesión para comentar.

Respuesta aceptada

Stephen23
Stephen23 el 6 de Abr. de 2015
Editada: Stephen23 el 6 de Abr. de 2015
Here are two simple ways to start a timer that counts from zero:
  • Use tic and toc to do the timing.
  • Use now, save the start time, and subtract this from all subsequent time values.
  1 comentario
mira
mira el 6 de Abr. de 2015
Editada: mira el 6 de Abr. de 2015
Hi, Can you show me how to save the start time using now? because I already use now, but seems not working. Much appreciated.Actually, I want to save the time when pressing the button.

Iniciar sesión para comentar.

Más respuestas (2)

Mahdiyar
Mahdiyar el 6 de Abr. de 2015
Hi mira
you can also use command "clock" as follows:
Start_Time = clock
it gives you the accurate time as following matrix
[year month day hour minute seconds]
Regrads
  1 comentario
mira
mira el 6 de Abr. de 2015
Editada: mira el 6 de Abr. de 2015
Hi Mahdiyar, I am already using the command just like you say,but the thing is how I want to save the start time. This because the first pressed button already need to save the time.so I have to minus the time of first press button with the start time. Hope you understand what I mean.

Iniciar sesión para comentar.


mira
mira el 6 de Abr. de 2015
thank you all.I get what I want now.

Categorías

Más información sobre Clocks and Timers en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by