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'];

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2022년 6월 30일

0 개 추천

My answer to your previous question is the answer. Just change seconds(1) to seconds(1/fs)

댓글 수: 6

Miguel Albuquerque
Miguel Albuquerque 2022년 6월 30일
That code, gives me a vector in datetime, how Can I pass it to number?
Fangjun Jiang
Fangjun Jiang 2022년 6월 30일
datenum(TimeVector)
Im doing this
RS_time=datenum(RS_time,'HH:MM:SS');
But it gives this error:
RS_time is the time vector= 1 x 1367 datetime
Error using datetime/datenum
Too many input arguments.
Fangjun Jiang
Fangjun Jiang 2022년 7월 1일
RS_time=datenum(RS_time)
Steven Lord
Steven Lord 2022년 7월 1일
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.
Miguel Albuquerque
Miguel Albuquerque 2022년 7월 2일
I have this vector in appendix, that starts with the first time: 1/fs: last time. But htis vector is in datetime and I needed it in number, but with this format ('HH-mm-ss_SSS'),
Can I do this, thanks

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 6월 30일

댓글:

2022년 7월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by