Replace values in grid data (3D) to NaN, like another (3D) have NaN
Show older comments
Hi to all
I have grid data VWind=300*16*21 and
SST=300*16*21 have NaN values
How i can to the replace NaN value at VWind data to the same location in SST data
Thanks in advance
Accepted Answer
More Answers (1)
Sudheer Bhimireddy
on 6 Aug 2020
I don't know if I understood your question properly, but here goes:
If you have NaN values in SST matrix and would like to replace VWind values to NaN wherever SST(i,j,k)=NaN:
VWind(isnan(SST)) = nan;
Similarly if VWind already has NaNs, to make corresponding indices of SST to NaN:
SST(isnan(VWind)) = nan;
If you run both these commands, then both your matrices will have same number of NaN values at same locations.
Hope this helps.
2 Comments
nada
on 6 Aug 2020
James Karden
on 1 Feb 2021
How could I get this to loop over each time step (let's say over 40 years) if I have a matrix of lat x lon x time?
Categories
Find more on Interpolation of 2-D Selections in 3-D Grids in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!