フィルターのクリア

how to get whole integers only using degrees2dms

1 回表示 (過去 30 日間)
That Guy
That Guy 2020 年 11 月 14 日
回答済み: Shadaab Siddiqie 2020 年 11 月 16 日
Im writing a function that returns a bearing given any azimuth. I have everything working except i want degrees2dms to only output whole numbers. Decimals are currently useless to me in this function so i would prefer to have whole numbers.
when i input 75.50275 as an angle into the function it returns [75, 30, 9.90] when I want it to return [75, 30, 10]. I want it to round down if the decimal is less than 5 and round up if it is equal or greater than 5. ie: 9.1 rounds to 9 while 9.6 rounds to 10
any help would be appreciated.
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 11 月 14 日
why not just round() the result ?

サインインしてコメントする。

回答 (1 件)

Shadaab Siddiqie
Shadaab Siddiqie 2020 年 11 月 16 日
From my understanding you want to round result from degrees2dms function. To solve this you can use round() function on the result.
result = round(degrees2dms(75.50275));
For more information you can refer round.

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by