| Mapping Toolbox | ![]() |
Converts formatted DMS angle strings to numbers.
Syntax
angles = str2angle(strings)
Description
angles = str2angle(strings) converts the formatted Degrees-Minutes-Seconds strings to numeric angles in units of degrees. Examples of recognized formats are 123°30'00"S, 123-30-00S, 123d30m00sS and 1233000S. The seconds field may contain a fractional component in all but the last form. Strings may be a character matrix or a cell array vector of strings.
Example
strs = {'23°30''00"N', '23-30-00S', '123d30m00sE', '1233000W'}
strs =
'23°30'00"N' '23-30-00S' '123d30m00sE' '1233000W'
str2angle(strs)
ans =
23.5
-23.5
123.5
-123.5
strs = strvcat(strs{:})
strs =
23°30'00"N
23-30-00S
123d30m00sE
1233000W
str2angle(strs)
ans =
23.5
-23.5
123.5
-123.5
See Also
angl2str |
Angle conversion to a string |
| stem3m | surfacem | ![]() |