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!