how to bin data based on two variables to create a joint occurance table?
7 次查看(过去 30 天)
显示 更早的评论
Hi everyone, I have only recently started to use MATLAB so please be patient, I'm sorry if I have trouble explaining myself properly.
I am trying to analyse the wave resource off the Isles of Scilly.
I have a huge structure array and I wish to sort the data into a table that shows how often conditions occur within bin ranges for two variables. i.e how often wave heights are between 3 - 3.5 meters whilst wave period is between 5 - 5.5 seconds. In this case the variables are called H and T.
H =[data(:,1).Hsig]<br>
T = [data(:,1).Tm_10]<br>
I have created one table so far using a simple for loop;
for i=0:0.5:10
m = [sum(H>=i & H<i+0.5 & T>=1.5 & T<2)]
end
However, obviously this only changes the height and I have manually changed the T values and run the program again whilst noting down the values each time. As you can see this is ridiculously crude and time consuming and I have 12 more tables to create, (one for each location).
Can anybody advise on how I can bin the data based on changing H and T values at the same time.
I realise I have explained this poorly, and I have attached a screen shot of the first table I have created to hopefully show what I am trying to do.
Any help will be immensely appreciated.
James
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!