Filter löschen
Filter löschen

how to get whole integers only using degrees2dms

1 Ansicht (letzte 30 Tage)
That Guy
That Guy am 14 Nov. 2020
Beantwortet: Shadaab Siddiqie am 16 Nov. 2020
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.

Antworten (1)

Shadaab Siddiqie
Shadaab Siddiqie am 16 Nov. 2020
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.

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by