How to get system date and time into simulink?
Mostrar comentarios más antiguos
Is there a way to get the system date and time (not simulation time) into simulink?
2 comentarios
TAB
el 28 de Feb. de 2012
In which datatype & formate?
How you are going to use it in simulink?
Jan De Vries
el 28 de Feb. de 2012
Respuesta aceptada
Más respuestas (4)
Rick Rosson
el 28 de Feb. de 2012
A slightly simpler version:
function [Y, M, D, H, MN, S] = sysClock()
coder.extrinsic('clock');
Y = 0;
M = 0;
D = 0;
H = 0;
MN = 0;
S = 0;
[Y, M, D, H, MN, S] = clock;
end
1 comentario
macs macalintal
el 1 de Mzo. de 2016
it says error, too many output arguments, help pls
Rick Rosson
el 28 de Feb. de 2012
5 comentarios
Jan De Vries
el 28 de Feb. de 2012
TAB
el 28 de Feb. de 2012
Try.........
function t = sysTime
eml.extrinsic('now');
t=0;
t = now;
end
Note:
'now' returns the current date and time as a serial date number.
Rick Rosson
el 28 de Feb. de 2012
Sorry, I forgot to include the extrinsic declaration. Thanks, TAB.
macs macalintal
el 7 de Mzo. de 2016
how to call the current time only, not with the current date?
Walter Roberson
el 7 de Mzo. de 2016
There is no way to fetch only the time without the date. The sysClock routine that Rick showed above can be modified to discard the date portions and return only the time components.
Jan De Vries
el 28 de Feb. de 2012
0 votos
Kareem Abdelgawad
el 24 de Nov. de 2014
0 votos
I tried to use it under 'Real-Time Windows Target', but it doesn't work. Any ideas how to read system time under 'Real-Time Windows Target'?
Categorías
Más información sobre Deployment, Integration, and Supported Hardware en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!