Create a time vector
6 views (last 30 days)
Show older comments
Hey guys, thanks in advance
I have a program that reads samples from hardware, and counts the time it takes to read that samples, so I have two variables of time in val2( the first time is the time it starts receiving, and the final time in val2 is the time it stops receiving).
I want to creat a time array in format :
Format = 'hh:mm:ss.SSS';
fs=10e6; % Frequency sampling of receiving the samples
And I want that this array is: first time: 1/fs : end time, basiccaly the values between the vector, should have the time dependent on the frequency sampling.
val2=['17-10-58_086'
'17-11-09_923'];
0 Comments
Answers (1)
Fangjun Jiang
on 30 Jun 2022
My answer to your previous question is the answer. Just change seconds(1) to seconds(1/fs)
6 Comments
Steven Lord
on 1 Jul 2022
You don't need to use datenum here. Note that the last line of code in the answer I posted in the thread linked above returns the number of seconds between the two times as a double array. If you want the number of minutes, hours, or days just replace seconds in that code with the appropriate one of those functions.
See Also
Categories
Find more on Time Series Objects 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!