Info

此问题已关闭。 请重新打开它进行编辑或回答。

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

1 次查看(过去 30 天)
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 个评论
Adrienne
Adrienne 2014-5-20
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

回答(1 个)

George Papazafeiropoulos
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 个评论
George Papazafeiropoulos
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.

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by