Main Content

map.geodesy.isDegree

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

Description

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.

example

Examples

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);
else
    y = cos(x);
end

Input Arguments

collapse all

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

Data Types: char | string

Output Arguments

collapse all

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

Version History

Introduced in R2013a