How to illustrate number of events per year/month (I want to

1 view (last 30 days)
I have table with seismic events containing date, coordinates, magnitudes of events.
I need to illustrate number of events per year/month, something like histogram.
I tried different solutions and also tried to look for it online, but it wasn't successful.
Please, help me anyone.
Table is attached

Accepted Answer

KSSV
KSSV on 22 Dec 2021
T = x1994_2020;
idx = isnat(T.(1)) ; % pick dates
T = T(~idx,:) ; % reove data for which there is no date
[y,m,d,H,M,S] = datevec(T.(1)) ;
mag = T.magnitude_Ml ;
[c,ia,ib] = unique(y) ;
N = length(c) ;
iwant = zeros(N,2) ;
for i = 1:N
iwant(i,1) = c(i) ; % year
iwant(i,2) = nnz(ib==i) ; % number of events
end
iwant

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!