MATLAB: How to automatically modify matrix

MATLABmatrix

Hi, I've tryin to modify couple of matrices to make a histogram. (Matrix composed with time, azimuth and the elevation in order)
Time step is 60 secs and time in the first cloumn being change much when elevation becomes zero(7496s to 44977)
So i want to assign 4th column with 0,1 to indicate elevation is over 0deg (1 for over than 0 deg)
Is there any way i could automatically put "1" from 4620 to 7496 per seconds?
Also put "0" from 7497 to 44976 and "1" again from 44977 till end.
Please let me know if there's any solution available.
Thank you in advance.
4620 0.730141039279308 15.993
4680 0.725690449686722 15.692
4740 0.721309673264217 15.39
4800 0.716998710011791 15.085
4860 0.712757559929444 14.778
4920 0.708603676309698 14.47
4980 0.704519605860031 14.16
5040 0.700487895287924 13.847
5100 0.696543451178417 13.533
5160 0.69266882023899 13.218
5220 0.688864002469642 12.901
5280 0.685128997870374 12.582
5340 0.681463806441186 12.261
5400 0.677868428182078 11.939
5460 0.674342863093049 11.616
5520 0.6708871111741 11.291
5580 0.667501172425231 10.964
5640 0.664185046846442 10.636
5700 0.660921281145213 10.307
5760 0.657744781906583 9.977
5820 0.654620642545513 9.645
5880 0.651566316354523 9.312
5940 0.648581803333613 8.978
6000 0.645667103482782 8.642
6060 0.642804763509512 8.306
6120 0.640012236706321 7.968
6180 0.63728952307321 7.63
6240 0.634619169317658 7.29
6300 0.632018628732187 6.95
6360 0.629487901316795 6.608
6420 0.627009533778963 6.266
6480 0.624600979411211 5.922
6540 0.622244784921018 5.578
6600 0.619958403600906 5.233
6660 0.617724382158353 4.887
6720 0.61556017388588 4.541
6780 0.613448325490967 4.193
6840 0.611388836973614 3.845
6900 0.60939916162634 3.497
6960 0.607479299449146 3.147
7020 0.605594343856993 2.797
7080 0.603779201434918 2.447
7140 0.602016418890404 2.096
7200 0.60032344951597 1.744
7260 0.598682840019095 1.392
7320 0.59709459039978 1.039
7380 0.595558700658025 0.686
7440 0.59407517079383 0.332
7496 0.592748720562314 0
44977 5.53847076864613 0
45037 5.53972740570756 0.363
45097 5.54094913618396 0.728
45157 5.54211850678279 1.094
45217 5.54325297079659 1.461
45277 5.54433507493283 1.828
45337 5.54538227248402 2.195
45397 5.54637711015766 2.563
45457 5.54731958795374 2.932
45517 5.54820970587225 3.302
45577 5.54906491720573 3.671
45637 5.54986776866165 4.042
45697 5.55061826024001 4.413
45757 5.55133384523332 4.785
45817 5.55197961705656 5.157
45877 5.55259048229476 5.529
45937 5.5531489876554 5.902
45997 5.55365513313848 6.276
46057 5.55410891874399 6.65
46117 5.55451034447195 7.025
46177 5.55485941032235 7.399
46237 5.55515611629519 7.775
46297 5.55540046239047 8.151
46357 5.55559244860819 8.527
46417 5.55573207494835 8.904
46477 5.55581934141095 9.28
46537 5.55583679470347 9.658
46597 5.55580188811843 10.036
46657 5.55573207494835 10.414

Best Answer

  • Extracting a few rows to illustrate:
    Matrix = [7380 0.595558700658025 0.686
    7440 0.59407517079383 0.332
    7496 0.592748720562314 0
    44977 5.53847076864613 0
    45037 5.53972740570756 0.363
    45097 5.54094913618396 0.728];
    then:
    Matrix(:,4) = 1.*(Matrix(:,3)>0)
    produces:
    Matrix =
    7380 0.59556 0.686 1
    7440 0.59408 0.332 1
    7496 0.59275 0 0
    44977 5.5385 0 0
    45037 5.5397 0.363 1
    45097 5.5409 0.728 1
    .