hello
well, your code looks a bit strange to me
first error is that find does not operate on table elements. You could have loaded directly your data as numeric data only with readmatrix (not need for readtable here)
then there are some lines wher the syntax makes me wonder where this code comes from :
N_freq = meanfreq(WNDIR,N_WND_IDX);
W_freq = meanfreq(WNDIR,W_WND_IDX);
S_freq = meanfreq(WNDIR,S_WND_IDX);
E_freq = meanfreq(WNDIR,E_WND_IDX);
I am not aware of a meanfreq function that has 2 input arguments (??)
also
sum(W_freq(S_WSPD_freq,M_WSPD_freq,W_WSPD_freq,WW_WSPD_freq,C_WSPD_freq),E_freq...
(S_WSPD_freq,M_WSPD_freq,W_WSPD_freq,WW_WSPD_freq,C_WSPD_freq))
sum(N_freq(S_WSPD_freq,M_WSPD_freq,W_WSPD_freq,WW_WSPD_freq,C_WSPD_freq),S_freq...
(S_WSPD_freq,M_WSPD_freq,W_WSPD_freq,WW_WSPD_freq,C_WSPD_freq))
wonder what this is supposed to do ... what are you trying to do ? what is the math behind this ?
at the end I wonder why you need to reinvent the wheel as they are already good stuff available on the FEX for wind rose plotting
let's pick this one :
and this is the result obtained in less than 1 minute of work
Tbl = readmatrix('WindRose.txt');
function wind_rose(wind_direction,wind_speed)
polarhistogram(deg2rad(wind_direction(wind_speed<25)),deg2rad(0:10:360),'displayname','20 - 25 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<20)),deg2rad(0:10:360),'FaceColor','red','displayname','15 - 20 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<15)),deg2rad(0:10:360),'FaceColor','yellow','displayname','10 - 15 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<10)),deg2rad(0:10:360),'FaceColor','green','displayname','5 - 10 m/s')
polarhistogram(deg2rad(wind_direction(wind_speed<5)),deg2rad(0:10:360),'FaceColor','blue','displayname','0 - 5 m/s')
pax.ThetaDir = 'clockwise';
pax.ThetaZeroLocation = 'top';