Group wind data in clusters based on direction

6 views (last 30 days)
I have an annual table with wind direction values and I want to group them per month in 16 sectors based on the degrees.
Is it possible to do it automatically either than manually?
  5 Comments
Ancalagon8
Ancalagon8 on 9 Jan 2023
@Adam Danz, @Walter Roberson thank you for your detailed and well-explained answers.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 8 Jan 2023
Edited: Star Strider on 8 Jan 2023
One way to do this would be to use the histcounts function and get the first three outputs —
WindDir = rand(100,1)*360;
edgev = linspace(0, 360, 9);
[N,Edges,Octant] = histcounts(WindDir, edgev);
WindOctants = table(WindDir,Octant)
WindOctants = 100×2 table
WindDir Octant _______ ______ 123.39 3 272.97 7 352.43 8 10.679 1 199.56 5 205.31 5 258.28 6 329.39 8 146.07 4 171.63 4 333.69 8 328.55 8 85.531 2 331.01 8 92.321 3 232.95 6
The first output are the number of counts in each octant (bonus information), and the third is the respective octant.
EDIT — (8 Jan 2023 at 16:30)
Added table.
.
  20 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Geographic Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!