how to get the time long after decimal point

2 vues (au cours des 30 derniers jours)
singh
singh le 14 Juin 2015
Modifié(e) : Jan le 14 Juin 2015
format longg
t=clock;
t1 = t([5,6]);
this code output is min(21) sec(19.955) now i wish to get after decimal point more than 5 digit and both minute and second will be show. is it possible

Réponses (2)

Azzi Abdelmalek
Azzi Abdelmalek le 14 Juin 2015
Modifié(e) : Azzi Abdelmalek le 14 Juin 2015
it's format long, with one g
format long
t=clock;
t1 = t([5,6])
  1 commentaire
Jan
Jan le 14 Juin 2015
Modifié(e) : Jan le 14 Juin 2015
"longG" is fine according to doc format . It works in lower case and with a space also:
format long g

Connectez-vous pour commenter.


Jan
Jan le 14 Juin 2015
The format command influences the output in the command window in general. When you want to modify a specific variable only, use sprintf or fprintf:
t = clock;
t1 = t(5:6);
fprintf('%.5f min %.5f sec\n', t1);

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by