Without using datevec, how can I get machine / computer real date and time into a simulink model for dSpace Real Time simulation?
Kshitij Singh answered .
2025-11-20
When working with Simulink in a dSPACE Real-Time Model, you can obtain the machine’s date and time for real-time simulations. Here are two approaches:
Using Embedded MATLAB Function Block:
function [Y, M, D, H, MN, S] = getDateTime()
eml.extrinsic('now');
eml.extrinsic('datevec');
nowTime = now();
[Y, M, D, H, MN, S] = datevec(nowTime);
end
Y, M, D, H, MN, and S represent the year, month, day, hour, minute, and second, respectively1.Using Real-Time Interface (RTI) with dSPACE Hardware: