how to make a timestamp for plotting out of (m:s:ms) ?

1 view (last 30 days)
I have an application which gets timevalues ( minutes,seconds,milliseconds) over TCP. This values are generated inside the module which sends data to matlab.
Now i want to convert this values to a timestamp to do some plotting. How can I archive this?
I tried this:
%save Data in Matrix
%make timestamp for plotting data.
timestamp = datetime(0,0,0,0,app.minute,app.second,app.millisecond);
%Save data in matrice for further operations(plotting,saving)
app.counter = app.counter + 1;
But it didn't work.
Thank you very much.
Kaan Inal
Kaan Inal on 23 Sep 2021
Thank you very much!
I now used array2timetable like this
%create timetable
array2timetable(app.BNO055Messung(:,4:13),'Samplerate',100,"VariableNames",{'acc_x','acc_y','acc_z','eul_x','eul_y','eul_z','quat_w','quat_x', 'quat_y', 'quat_z'});
%save table as .txt file
Now i have a .tx file looking like this:
0 sec,-0.36,-0.4,9.39,6.875,-1.8125,2.5,0.997802734375,-0.02130126953125,0.017333984375,-0.0599365234375
0.01 sec,-0.35,-0.38,9.38,6.875,-1.8125,2.5,0.997802734375,-0.02130126953125,0.017333984375,-0.0599365234375
0.02 sec,-0.33,-0.39,9.38,6.875,-1.8125,2.5,0.997802734375,-0.02130126953125,0.017333984375,-0.0599365234375
Now i want to LOAD this txt file and save it again in a variable of type timetable for plotting and analysis.
But the following code doesnt work:
TT = readtimetable(app.FilenameEditField.Value,"RowTimes",'Time',"DurationType","duration");
Error message: Error using readtimetable (line 284)
Row times must be datetime or duration vector.
Thank you for your help!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by