how to make a timestamp for plotting out of (m:s:ms) ?
2 views (last 30 days)
Show older comments
Hello,
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.x(app.counter,:)=[timestamp,accx,accy,accz,eulx,euly,eulz];
app.counter = app.counter + 1;
But it didn't work.
Thank you very much.
2 Comments
Siddharth Bhutiya
on 21 Sep 2021
Just based on the information in your question, it seems that you are working with time periods rather than date times. So it seems logical to use duration instead of datetime.
timestamp = duration(0,app.minute,app.second,app.millisecond);
What are the data types of your other values (app.x, accx, accy, eulz, etc.) assuming they are doubles, then you are trying to mix different types in an array which is not supported. When trying to store heterogeneous types you could use table or better timetables since your data seems to be timestamped.
It is difficult to infer a lot just from few lines of code. If you are still stuck then please include some sample data on what each value described in your code looks like and also the exact errors that you are getting. Having more context about the code and data would make it easier for people to provide suggestions.
Answers (0)
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!