hello every one ...i need program for clock..or for e.g need code to write clock
Mostrar comentarios más antiguos
my name is Masoud i study M.s mechanic engineer .i don't work for build clock but i use other code to Matlab... thank you for answer this question
11 comentarios
Walter Roberson
el 29 de Nov. de 2015
What does the clock need to do ?
masoud mansouri
el 29 de Nov. de 2015
John D'Errico
el 29 de Nov. de 2015
Look on the file exchange.
Jan
el 29 de Nov. de 2015
@masoud: In the first part of the comment, you state, that you do not need the tic, toc behavior. Then you explain exactly the purpose of tic toc explicitly. Therefore I still do not understand what you want. Please post a small example what should appeare where. And please post this by editing the original question, not hidden in a list of comments. Thanks.
Image Analyst
el 29 de Nov. de 2015
What does "i use other code to Matlab" mean? Do you mean that you have code that also doesn't work in some other language, such as C, Java, or Python? Do you want to write this in MATLAB or not?
Shameer Parmar
el 1 de Dic. de 2015
Editada: Shameer Parmar
el 1 de Dic. de 2015
@Masoud: I also not able to understand your exact requirement, but I guess you need code to display current time and date.
Try for this command in Matlab command window, if this can help you..--> java.util.Date()
you can use following code to split it and can store into separate var.
timeStr = char(java.util.Date());
day = timeStr(1:3);
month = timeStr(5:7);
date = timeStr(9:11);
time = timeStr(12:19);
timeZone = timeStr(21:23);
year = timeStr(25:28);
masoud mansouri
el 2 de Dic. de 2015
Editada: Image Analyst
el 2 de Dic. de 2015
Thorsten
el 2 de Dic. de 2015
So what is this clock program supposed to do?
masoud mansouri
el 2 de Dic. de 2015
Image Analyst
el 2 de Dic. de 2015
We don't know what you want. Specifically, you said you searched the File Exchange like John suggested but found nothing. But when I search it ( http://www.mathworks.com/matlabcentral/fileexchange/?utf8=%E2%9C%93&term=clock It brought up lots of clocks. Why don't any of them work? What about Thorsten's answer below, or Jan or Shameer's comments above using simple date and time strings and functions built into MATLAB? What's wrong with them?
masoud mansouri
el 3 de Dic. de 2015
Respuesta aceptada
Más respuestas (1)
To show the current date and time, use
datestr(now)
If you want to measure the time, you can use tic; toc or clock and etime, as explained in
help etime
Categorías
Más información sobre Clocks and Timers en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!