hello every one ...i need program for clock..or for e.g need code to write clock
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 29 Nov 2015
What does the clock need to do ?
masoud mansouri
le 29 Nov 2015
John D'Errico
le 29 Nov 2015
Look on the file exchange.
Jan
le 29 Nov 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
le 29 Nov 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
le 1 Déc 2015
Modifié(e) : Shameer Parmar
le 1 Déc 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
le 2 Déc 2015
Modifié(e) : Image Analyst
le 2 Déc 2015
Thorsten
le 2 Déc 2015
So what is this clock program supposed to do?
masoud mansouri
le 2 Déc 2015
Image Analyst
le 2 Déc 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
le 3 Déc 2015
Réponse acceptée
Plus de réponses (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
Catégories
En savoir plus sur Clocks and Timers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!