How to get system date and time into simulink?
显示 更早的评论
Is there a way to get the system date and time (not simulation time) into simulink?
2 个评论
TAB
2012-2-28
In which datatype & formate?
How you are going to use it in simulink?
Jan De Vries
2012-2-28
采纳的回答
更多回答(4 个)
Rick Rosson
2012-2-28
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 个评论
macs macalintal
2016-3-1
it says error, too many output arguments, help pls
Rick Rosson
2012-2-28
5 个评论
Jan De Vries
2012-2-28
TAB
2012-2-28
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
2012-2-28
Sorry, I forgot to include the extrinsic declaration. Thanks, TAB.
macs macalintal
2016-3-7
how to call the current time only, not with the current date?
Walter Roberson
2016-3-7
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.
Kareem Abdelgawad
2014-11-24
0 个投票
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'?
类别
在 帮助中心 和 File Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!