This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


True if input matches'degree' and false if 'radian'


tf = map.geodesy.isDegree(angleUnit)



tf = map.geodesy.isDegree(angleUnit) returns true if angleUnit is a partial match for 'degree' (or 'degrees') and false if angleUnit is a partial match for 'radian' (or 'radians'). If angleUnit matches neither 'degrees' or 'radians', map.geodesy.isDegree returns an error.


collapse all

Create a function to calculate a cosine. In the function, use map.geodesy.isDegree to check the validity of the inputs.

function y = cosine(x, angleUnit)
% X can be in either degrees or radians
if map.geodesy.isDegree(angleUnit)
    y = cosd(x);
    y = cos(x);

Input Arguments

collapse all

Angle unit value, specified as 'degree' or 'radian'.

Data Types: char

Output Arguments

collapse all

True/false flag indicating if a match was found, returned as a logical scalar.

Introduced in R2013a

Was this topic helpful?