?? nansum.m
字號:
function y = nansum(x)%NANSUM Sum ignoring NaNs.%% NANSUM(X) returns the sum over non-NaN elements of X. For% vectors, NANSUM(X) is the sum of the non-NaN elements in X. For% matrices, NANSUM(X) is a row vector containing the sum of the% non-NaN elements in each column of X.%% See also NANMEAN, NANSTD. error(nargchk(1,1,nargin)) % check number of input arguments % replace NaNs with zeros. nans = isnan(x); inan = find(nans); x(inan) = zeros(size(inan)); y = sum(x); % protect against an entire column of NaNs iall = find(all(nans)); y(iall) = NaN;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -