Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Need help with code conversion from C++ to Matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I am creating a function in matlab that will take GPS week number and second of the week as an input and return year, month, day, hh,mm,ss as its output.
I tried searching for a formula but I was't able to get it.
If someone can help me translate the following code, I will be very thankful for this act of kindness
Thank you please see the attached code snippet.
void gps2date(const gpstime_t *g, datetime_t *t)
{
// Convert Julian day number to calendar date
int c = (int)(7*g->week + floor(g->sec/86400.0)+2444245.0) + 1537;
int d = (int)((c-122.1)/365.25);
int e = 365*d + d/4;
int f = (int)((c-e)/30.6001);
t->d = c - e - (int)(30.6001*f);
t->m = f - 1 - 12*(f/14);
t->y = d - 4715 - ((7 + t->m)/10);
t->hh = ((int)(g->sec/3600.0))%24;
t->mm = ((int)(g->sec/60.0))%60;
t->sec = g->sec - 60.0*floor(g->sec/60.0);
return;
}
댓글 수: 2
KSSV
2022년 1월 24일
MATLAB should have some inbuilt function for this. Show us your input and what you are expecting?
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!