Compass Direction Conversion with Matlab

Compass direction conversion from cardinals to degrees and backward.

You are now following this Submission

The present codes are a set of two Matlab functions named “cardinal2deg” and “deg2cardinal”, designed to convert compass directions between cardinals and degrees. The first function allows the user to input cardinal directions (e.g., N, NNE, NE, etc.) and obtain the corresponding degree values (e.g., 0, 22.5, 45, etc.). Conversely, the second function allows conversion from degree values to the corresponding cardinal directions, offering a bidirectional conversion capability. The functions are valuable tools that facilitate the compass direction conversions for geographic data processing applications.
Three examples are given to clarify the usage of the two functions. For convenience, the input and output arguments are given at the beginning of the functions.

Cite As

Hristo Zhivomirov (2026). Compass Direction Conversion with Matlab (https://www.mathworks.com/matlabcentral/fileexchange/168891-compass-direction-conversion-with-matlab), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.1.0

A new version of the codes has been uploaded.

1.0.0