How do I replace -1.0000e+30 with NaN?
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to replace -1.0000e+30 in an array of SST and used the following but its not working why?:
data=netcdf.open('HadISST_sst1.nc','NC_NOWRITE')
time=netcdf.getVar(data,0);
time_bnds=netcdf.getVar(data,1);
lat=netcdf.getVar(data,2);
lon=netcdf.getVar(data,3);
sst=netcdf.getVar(data,4);
sst(sst==-1.0000*1e+30)=NaN;
댓글 수: 0
채택된 답변
KSSV
2022년 11월 9일
Let T be your array.
tol = -10^10 ; % fix this to satisfied value
T(T<tol) = NaN ;
댓글 수: 3
추가 답변 (1개)
Steven Lord
2022년 11월 9일
Since I'm guessing -1e30 is an outlier in your data you could use filloutliers. I'll use a slightly smaller outlier value for this example because it makes y display more nicely.
y = 1:10;
y(7) = 100
y2 = filloutliers(y, NaN)
댓글 수: 2
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!