how to bin data based on two variables to create a joint occurance table?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
j atkinson
am 15 Feb. 2016
Kommentiert: j atkinson
am 15 Feb. 2016
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155031/image.png)
Any help will be immensely appreciated.
James
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!