How to add a timestamp to array in simulink?

Hello,
I have problem with adding a timestamp in simulink. I have array date (9 values) from IMU sensor like on the picture and I need to add a tenth kolumn with timestamp (with milisecond).
I have tried like on the picture below with code in matlab function:
function [Y, M, D, H, MN, S, MS] = fcn()
eml.extrinsic('now');
eml.extrinsic('datevec');
Y = 0;
M = 0;
D = 0;
H = 0;
MN = 0;
S = 0;
MS = 0;
[Y, M, D, H, MN, S, MS] = datevec(now);
end
And to create a file with txt format I used a command:
dlmwrite('E:\temp.txt', sumout111,'delimiter','\t','precision',3)
When I run simulation I have error:
Ok, I have changed directory and ran as admin Matlab and I have another problem:
%

 Réponse acceptée

ES
ES le 2 Août 2017
1. If you want to run the model as a regular user, you can set the cache folder to some folde other than C:\Windows... Example:
set_param(0, 'CacheFolder', 'D:\Temp')
2. If you want to run as Admin, after the \MATLAB opens up, do mex-setup and select host compiler(lcc or MSVC++) : Reason: For each profile, the mex settings are stored separately.

Plus de réponses (1)

plaziok
plaziok le 2 Août 2017
Modifié(e) : plaziok le 2 Août 2017

0 votes

It works. Thanks a lot.
And I had to delete 'MS' from code because datavec returns only 6 values. Datevec returns milliseconds as a fractional part of the seconds (S) output (for example 15.6).

Catégories

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by