MATLAB: How to set all elements of a matrix that meet a certain criteria to NaN findMATLAB I have a Matrix A with the size of [200 100 20 60]. How do I set all elements larger than 10^20 as NaN? Best Answer Try this:A(A > 1E+20) = NaN; Related SolutionsMATLAB: Is griddedinterpolant omits NaN You can find out by yourself[X,Y] = meshgrid(0:10);Z = 0*X;Z(5:7,5:7) = nan;surf(X,Y,Z,'edgecolor','none')[X1,Y1] = meshgrid(0:0.4:10);Z1 = griddata(X,Y,Z,X1,Y1);hold onsurf(X1,Y1,Z1,'facecolor','none')hold off MATLAB: Does a cell vector contains only NaN cisnan = @(C)all(cellfun(@(x)all(isnan(x(:))),C));cisnan(your_cell) Related QuestionNormalise a Histogram excluding NaNHow to combine arrays using NaNPlotting time series with NaNAssigning NaN to certain values
Best Answer