Oh no! A(A==0)=NaN is turning my matrix into all zeros!!
2 次查看(过去 30 天)
显示 更早的评论
Okay, I'm feeling like an idiot, what on earth could I be doing wrong?
>> whos KoppenDsb_airT
Name Size Bytes Class Attributes
KoppenDsb_airT 360x720x361 374284800 single
>> min(min(KoppenDsb_airT))
ans(:,:,1) =
-26.5479
ans(:,:,2) =
-23.5349
ans(:,:,3) =
-22.6819
ans(:,:,4) =
-17.3890
ans(:,:,5) =
-12.0117
ans(:,:,6) =
-8.7705
ans(:,:,7) =
-5.3165
ans(:,:,8) =
0
ans(:,:,9) =
0
etc...
KoppenDsb_airT(KoppenDsa_airT==0)= nan;
>> min(min(KoppenDsb_airT))
ans(:,:,1) =
0
ans(:,:,2) =
0
ans(:,:,3) =
0
ans(:,:,4) =
0
ans(:,:,5) =
0
ans(:,:,6) =
0
ans(:,:,7) =
0
ans(:,:,8) =
0
ans(:,:,9) =
0
etc...
Any idea what I'm doing wrong? Thanks!
0 个评论
采纳的回答
the cyclist
2013-7-12
编辑:the cyclist
2013-7-12
I think you may be mixing up your variables
KoppenDsa_airT
and
KoppenDsb_airT
Still, the result is puzzling to me.
Is the array the same shape after that operation?
3 个评论
Matt Kindig
2013-7-12
If you have the Statistics toolbox installed, you can you nanmean() to take the mean and ignore NaN's.
doc nanmean
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!