Merge multiple cells into one cell array
Show older comments
I have a three different cell arrays for my DMS (degree, minute, second). I want to combine it into one cell into the DMS format (degree°minute'second"). The second(") data is a decimal number while degree and minutes are integers.
I have a data of like this:
Degrees (19x1) = 128
128 ......
Minutes (19x1) = 34
32....
Seconds (19x1)= 14.651
40.654
How can I combine this three cell arrays into a form such that:
128°34'14.651"
128°32'40.654"
this is what I want to be the result.
Answers (1)
n = 3;
Degrees = randi([0 359], [n, 1])
Minutes = randi([0 59], [n, 1])
Seconds = rand([n, 1])*60
s = compose("%d%c%d%c%.4f%c", Degrees, char(176), Minutes, "'", Seconds, '"')
Categories
Find more on Lengths and Angles in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!