trying to delete 2 cells of Nans, NOT To delete the row

I am trying to get rid of the 2 Nans in two columns that are produced in the av_pwrmn, sdav_pwrmn, PPWRM and sdpeak_pwr JHSD and JHMN. They are always in the same place, [row col] = 2 5 and 4 6. However I want to make the code as universal as possible so I could apply it to another code just similar to this one.
i don't know if an 'if' statement would work? i did try to use nancov but it gave me a 7x7 matrix instead of a 4x7 matrix.
% finding mean and SD
for ii=1:6;
for jt= 1:4;
x= find(JT_S_TN(:,1)==ii);
y= find(JT_S_TN(x,2)==jt);
JHMN(jt,ii)= mean(jh(x(y)));
JHSD(jt,ii)= std(jh(x(y)));
av_pwrmn(jt,ii)= mean(av_pwr(x(y)));
sdav_pwr(jt,ii)= std(av_pwr(x(y)));
PPWRM(jt,ii)= mean(peak_pwr(x(y)));
sdpeak_pwr(jt,ii)= std(peak_pwr(x(y)));
av_pwrmn1= nancov(av_pwrmn); % my attempt at nancov
end
end

5 Comments

What are the arrays JT_S_TN, jh, av_pwr and peak_pwr? Could you give their typical values?
JT_S_TN:
if true
1 3
1 3
1 3
2 4
2 4
2 4
3 1
3 1
3 1
4 2
4 2
4 2
5 4
5 4
5 4
6 2
6 2
6 2
7 3
7 3
7 3
1 4
1 4
1 4
2 3
2 3
2 3
3 3
3 3
3 3
4 1
4 1
4 1
5 4
5 4
5 4
6 1
6 1
6 1
7 2
7 2
7 2
1 1
1 1
1 1
2 2
2 2
2 2
3 2
3 2
3 2
4 3
4 3
4 3
5 1
5 1
5 1
6 3
6 3
6 3
7 4
7 4
7 4
1 2
1 2
1 2
2 1
2 1
2 1
3 4
3 4
3 4
4 4
4 4
4 4
5 3
5 3
5 3
6 2
6 2
6 2
7 1
7 1
7 1
av_pwr:
659.844636466159
921.319959806683
935.833632637015
1190.27550060317
1152.84166762511
1038.99491457384
949.188051378324
861.438150054137
908.529255691218
1197.26558603846
976.285297014679
1152.86880954023
700.219689248321
726.827878193760
685.156970311236
589.272248745282
889.491930710988
896.219457644087
1092.36813127631
1083.65135414558
667.093401862048
970.697054901588
927.070580953313
941.236606903736
1158.76449801355
1043.27734956244
1194.48885128728
810.578296266778
803.658847766545
797.450712646922
1123.38650746023
1239.73637823579
1304.91649829334
692.530499446934
678.652895038422
612.347262404654
725.516741046530
821.679681790733
830.054715412928
957.651732437553
1178.03876864472
1237.56547223801
921.690707112269
1167.99677525092
1156.55401242931
1049.01877394830
1061.84877014472
1027.13019076398
738.978576763317
913.779060952257
875.991299784296
1062.66507239936
1045.11206685404
1035.48166760110
700.188992570262
696.063435976613
857.509120880935
985.531881877081
902.601797858132
803.086349879987
1094.59744310117
1109.28024254057
1071.97784323432
910.904924550996
1042.75783898180
941.413413071782
1035.67539560032
1054.14457303385
1033.77104100897
808.077065868452
800.963080099284
762.645326426809
1076.58144595628
1063.81718351298
1069.66286511269
708.147171045570
690.370423765364
672.387812713896
673.877830205383
681.283320555798
828.869480535477
1199.49936736164
1225.47626878916
1352.99514329611
peak_pwr:
1616.68515000000
1538.61126443203
1538.27803473492
1908.27088038095
1866.23442211896
2072.63510630631
1610.98670781609
1419.22491682243
1463.18488758030
1967.17609963570
1866.44420454545
1937.87204682836
1292.07995106888
1303.54987425287
1241.48573904762
2029.63180000000
1845.34742260062
1973.85865696784
2449.31581721959
2538.02335651466
2711.12640000000
1827.78382786885
1726.18974131206
1716.30247750865
1846.96489175050
1969.70309141221
2020.13059229287
1276.89799495413
1265.76898640553
1310.95983921114
1730.80914767933
1822.04081606765
2032.94576798246
1305.11575803571
1297.54824916865
1307.61555000000
1920.48560000000
1687.97428399312
1791.08395147314
1950.44716119403
1879.65138855422
1831.00186060606
1548.61351588595
1765.48326315790
1814.96058691207
1985.30309287212
2002.52112896825
1859.14909820000
1713.08297263158
1497.91023689727
1729.75831649899
1841.27488850325
1726.85655541126
1702.63971580087
1265.08460471204
1284.43131763224
1239.04548189415
1826.18277512777
1801.02608798646
1889.79619795222
2703.70342792793
2999.87279821958
2751.47340000000
1817.04205785441
1751.62967155323
1897.90092526690
1810.00438854806
1899.10076631579
1846.82884843424
1468.29333319415
1432.70273236515
1471.83819543568
1933.05801161049
2028.53816051188
1946.12324548872
1202.75898236776
1227.63229104478
1154.02032709360
2097.87050000000
2099.58300000000
2027.83007800312
1723.32994039735
1759.43912195122
1777.81214426230
jh:
if true
1.22625000000000e-06
0.352296720000000
0.365564745000000
0.336698820000000
0.353612486250000
0.376355745000000
0.230971545000000
0.223580936250000
0.266287545000000
0.368247780000000
0.340565186250000
0.350983406250000
0.216310500000000
0.230971545000000
0.215281676250000
1.22625000000000e-06
0.510150656250000
0.521283780000000
0.489793680000000
0.460786736250000
1.22625000000000e-06
0.454792826250000
0.388683236250000
0.408254186250000
0.301677120000000
0.335414936250000
0.329032305000000
0.232037156250000
0.229908386250000
0.226733625000000
0.274347686250000
0.273188880000000
0.253864406250000
0.245015786250000
0.216310500000000
1.22625000000000e-06
1.22625000000000e-06
0.412510500000000
0.406840320000000
0.548821676250000
0.539021486250000
0.532537076250000
0.294422625000000
0.298038836250000
0.292024080000000
0.277838820000000
0.310252286250000
0.305337476250000
0.275508945000000
0.277838820000000
0.301677120000000
0.259474500000000
0.260603876250000
0.260603876250000
0.178003676250000
0.192295620000000
0.157161105000000
0.421089345000000
0.426857625000000
0.419653406250000
0.542278406250000
0.555404186250000
0.548821676250000
0.332854526250000
0.401209380000000
0.385926626250000
0.292024080000000
0.275508945000000
0.280178505000000
0.280178505000000
0.283706426250000
0.283706426250000
0.348364136250000
0.365564745000000
0.345754676250000
0.192295620000000
0.197182226250000
0.201135656250000
1.22625000000000e-06
1.22625000000000e-06
0.502272000000000
0.445875536250000
0.402613436250000
0.454792826250000
end

Answers (1)

At least one of the values of JT_S_TN([13,14,15,34,35,36,55,56,57,76,77,78],2) must be equal to 2
and
at least one of the values of JT_S_TN([16,17,18,37,38,39,58,59,60,79,80,81],2) must be equal to 4
for the loop to give results without NaN values

2 Comments

what do you mean it is equal to 2 or 4?
At least one of the values in the second column of JT_S_TN, and rows 13,14,15,34,35,36,55,56,57,76,77,78 must be equal to 2. Respectively for positions 16,17,18,37,38,39,58,59,60,79,80,81 of the same column, same matrix, there must be a 4.

This question is closed.

Tags

Asked:

on 20 May 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!