The data that I'm processing is temporal variation of water column height (in meters). I'm only interested in the third column (dates) and the last column (water column height). I put a sample of the data below but originally I have 1272 lines of data.
2016 02 14 23 45 00 1 3792.492
2016 02 14 23 30 00 1 3792.495
2016 02 14 23 15 00 1 3792.504
2016 02 14 23 00 00 1 3792.515
2016 02 14 22 45 00 1 3792.526
2016 02 14 22 30 00 1 3792.537
2016 02 14 22 15 00 1 3792.553
2016 02 14 22 00 00 1 3792.568
2016 02 14 21 45 00 1 3792.582
2016 02 14 21 30 00 1 3792.599
2016 02 14 21 15 00 1 3792.616
2016 02 14 21 00 00 1 3792.632
2016 02 14 20 45 00 1 3792.647
2016 02 14 20 30 00 1 3792.663
2016 02 14 20 15 00 1 3792.678
2016 02 14 20 00 00 1 3792.693
2016 02 14 19 45 00 1 3792.705
2016 02 14 19 30 00 1 3792.719
2016 02 14 19 15 00 1 3792.733
2016 02 14 19 00 00 1 3792.741
2016 02 14 18 45 00 1 3792.746
2016 02 14 18 30 00 1 3792.752
2016 02 14 18 15 00 1 3792.754
2016 02 14 18 00 00 1 3792.754
2016 02 14 17 45 00 1 3792.754
2016 02 14 17 30 00 1 3792.751
2016 02 14 17 15 00 1 3792.745
2016 02 14 17 00 00 1 3792.739
2016 02 14 16 45 00 1 3792.730
2016 02 14 16 30 00 1 3792.719
2016 02 14 16 15 00 1 3792.706
2016 02 14 16 00 00 1 3792.694
2016 02 14 15 45 00 1 3792.682
2016 02 14 15 30 00 1 3792.668
2016 02 14 15 15 00 1 3792.651
2016 02 14 15 00 00 1 3792.634
2016 02 14 14 45 00 1 3792.616
2016 02 14 14 30 00 1 3792.599
2016 02 14 14 15 00 1 3792.584
2016 02 14 14 00 00 1 3792.569
2016 02 14 13 45 00 1 3792.554
2016 02 14 13 30 00 1 3792.540
2016 02 14 13 15 00 1 3792.522
2016 02 14 13 00 00 1 3792.511
2016 02 14 12 45 00 1 3792.506
2016 02 14 12 30 00 1 3792.504
2016 02 14 12 15 00 1 3792.503
2016 02 14 12 00 00 1 3792.505
2016 02 14 11 45 00 1 3792.504
2016 02 14 11 30 00 1 3792.511
2016 02 14 11 15 00 1 3792.521
2016 02 14 11 00 00 1 3792.532
2016 02 14 10 45 00 1 3792.544
2016 02 14 10 30 00 1 3792.557
2016 02 14 10 15 00 1 3792.571
2016 02 14 10 00 00 1 3792.586
2016 02 14 09 45 00 1 3792.604
2016 02 14 09 30 00 1 3792.621
2016 02 14 09 15 00 1 3792.637
2016 02 14 09 00 00 1 3792.656
2016 02 14 08 45 00 1 3792.672
2016 02 14 08 30 00 1 3792.690
2016 02 14 08 15 00 1 3792.708
2016 02 14 08 00 00 1 3792.727
2016 02 14 07 45 00 1 3792.744
2016 02 14 07 30 00 1 3792.760
2016 02 14 07 15 00 1 3792.778
2016 02 14 07 00 00 1 3792.792
2016 02 14 06 45 00 1 3792.802
2016 02 14 06 30 00 1 3792.809
2016 02 14 06 15 00 1 3792.817
2016 02 14 06 00 00 1 3792.820
2016 02 14 05 45 00 1 3792.819
2016 02 14 05 30 00 1 3792.815
2016 02 14 05 15 00 1 3792.809
2016 02 14 05 00 00 1 3792.798
2016 02 14 04 45 00 1 3792.786
2016 02 14 04 30 00 1 3792.773
2016 02 14 04 15 00 1 3792.758
2016 02 14 04 00 00 1 3792.739
2016 02 14 03 45 00 1 3792.721
2016 02 14 03 30 00 1 3792.699
2016 02 14 03 15 00 1 3792.679
2016 02 14 03 00 00 1 3792.662
2016 02 14 02 45 00 1 3792.642
2016 02 14 02 30 00 1 3792.616
2016 02 14 02 15 00 1 3792.586
2016 02 14 02 00 00 1 3792.563
2016 02 14 01 45 00 1 3792.545
2016 02 14 01 30 00 1 3792.528
2016 02 14 01 15 00 1 3792.509
2016 02 14 01 00 00 1 3792.487
2016 02 14 00 45 00 1 3792.463
2016 02 14 00 30 00 1 3792.447
2016 02 14 00 15 00 1 3792.439
2016 02 14 00 00 00 1 3792.436
2016 02 13 23 45 00 1 3792.432
2016 02 13 23 30 00 1 3792.430
2016 02 13 23 15 00 1 3792.430
2016 02 13 23 00 00 1 3792.433
2016 02 13 22 45 00 1 3792.436
2016 02 13 22 30 00 1 3792.445
2016 02 13 22 15 00 1 3792.456
2016 02 13 22 00 00 1 3792.470
2016 02 13 21 45 00 1 3792.487
2016 02 13 21 30 00 1 3792.503
2016 02 13 21 15 00 1 3792.522
2016 02 13 21 00 00 1 3792.544
2016 02 13 20 45 00 1 3792.565
2016 02 13 20 30 00 1 3792.587
2016 02 13 20 15 00 1 3792.614
2016 02 13 20 00 00 1 3792.635
2016 02 13 19 45 00 1 3792.656
2016 02 13 19 30 00 1 3792.680
2016 02 13 19 15 00 1 3792.706
2016 02 13 19 00 00 1 3792.728
2016 02 13 18 45 00 1 3792.748
2016 02 13 18 30 00 1 3792.768
2016 02 13 18 15 00 1 3792.784
2016 02 13 18 00 00 1 3792.797
2016 02 13 17 45 00 1 3792.805
2016 02 13 17 30 00 1 3792.811
2016 02 13 17 15 00 1 3792.815
2016 02 13 17 00 00 1 3792.817
2016 02 13 16 45 00 1 3792.815
2016 02 13 16 30 00 1 3792.809
2016 02 13 16 15 00 1 3792.797
2016 02 13 16 00 00 1 3792.787
2016 02 13 15 45 00 1 3792.775
2016 02 13 15 30 00 1 3792.762
2016 02 13 15 15 00 1 3792.746
2016 02 13 15 00 00 1 3792.727
2016 02 13 14 45 00 1 3792.707
2016 02 13 14 30 00 1 3792.684
2016 02 13 14 15 00 1 3792.662
2016 02 13 14 00 00 1 3792.640
2016 02 13 13 45 00 1 3792.619
2016 02 13 13 30 00 1 3792.601
2016 02 13 13 15 00 1 3792.583
2016 02 13 13 00 00 1 3792.558
2016 02 13 12 45 00 1 3792.531
2016 02 13 12 30 00 1 3792.506
2016 02 13 12 15 00 1 3792.492
2016 02 13 12 00 00 1 3792.486
2016 02 13 11 45 00 1 3792.483
2016 02 13 11 30 00 1 3792.479
2016 02 13 11 15 00 1 3792.476
2016 02 13 11 00 00 1 3792.477
2016 02 13 10 45 00 1 3792.480
2016 02 13 10 30 00 1 3792.485
2016 02 13 10 15 00 1 3792.489
2016 02 13 10 00 00 1 3792.499
2016 02 13 09 45 00 1 3792.515
2016 02 13 09 30 00 1 3792.532
2016 02 13 09 15 00 1 3792.548
2016 02 13 09 00 00 1 3792.565
2016 02 13 08 45 00 1 3792.585
2016 02 13 08 30 00 1 3792.607
2016 02 13 08 15 00 1 3792.631
2016 02 13 08 00 00 1 3792.657
2016 02 13 07 45 00 1 3792.681
2016 02 13 07 30 00 1 3792.704
2016 02 13 07 15 00 1 3792.729
I've defined matrix of dates dcat and matrix of water column height hcat. I've managed to put all of water column height data side-by-side with their corresponding dates, dat_h. My goal is to be able to put a table of date groups (14 days) in columns against water column height groups in rows (or vice versa) with the number of occurence of water column bigger than each groups (meaning >= each element in hcat).
What I understand is we need to make several loop: one going through all element of dcat, another going through hcat, and the last is going through all of the element of dat_h.
col=load('col-deau');
days=datenum(col(:,1),col(:,2),col(:,3),col(:,4),col(:,5),col(:,6));
date=datestr(days());
h=col(:,8);
dates=col(:,3);
nbin=10;
%les dates et les valeurs où l'hauteur = 9999.000
days=days(h~=9999.000);
h=h(h~=9999.000);
dates=sort(dates(h~=9999.000));
% Generate date categories
dcat=min(dates):1:max(dates);
% Put column height and date side-by-side
dat_h=[dates, h];
% Generate water column height categories
hcat=linspace(min(dat_h(:,2)),max(dat_h(:,2)),10);
% Loop for calculating height column occurences in corresponding dates
for i=1:length(dcat)
for j=1:length(hcat)
for k=1:length(dat_h)
if i==dat_h(k,1)
nx(i,j)=length(find(dat_h>=hcat(j)));
else
continue
endif
endfor
endfor
endfor
But something doesn't seem right. nx is in good dimension (14x10) but the values inside are weird:
nx=
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
1272 1204 1085 893 657 432 256 138 41 1
I'm sure that there should be a variation in values either along columns or rows or even both. Any ideas where is my error?
Aucun commentaire:
Enregistrer un commentaire