Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.4.0 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda Scilab >> Estatística > Data with Missing Values > nansum

nansum

Sum of values ignoring NAN's

Calling Sequence

s = nansum(x,orient)

Arguments

x

numerical vector or matrix.

orient

nothing or '*'. 'r' or 1. 'c' or 2.

s

Numerical scalar or vector containig the value of the adding operation.

Description

This function returns in s the sum of the values (ignoring the NAN's) of a numerical vector or matrix x.

For a vector or matrix x, s=nansum(x) (or s=nansum(x,'*')) returns in scalar s the sum of values of all entries (ignoring the NAN's) of a vector or matrix x.

s=nansum(x,'r')(or, equivalently, s=nansum(x,1)) returns in each entry of the row vector s of type 1xsize(x,'c') the sum of each column of x (ignoring the NANs).

s=nansum(x,'c')(or, equivalently, s=nansum(x,2)) returns in each entry of the column vector s of type size(x,'c')x1 the sum of each row of x (ignoring the NANs).

For the last two cases, if a row or column is in whole composed of NAN, the corresponding place of s will contain a NAN.

Examples

x=[0.2113249 %nan 0.6653811;0.7560439 0.3303271 0.6283918]
m=nansum(x)
m=nansum(x,1)
m=nansum(x,2)

See Also

  • nancumsum — Thos function returns the cumulative sum of the values of a matrix
  • sum — soma (soma linha, soma coluna) de entradas de um vetor ou matriz

Bibliography

Wonacott, T.H. and Wonacott, R.J.; Introductory Statistics, 5th edition, J.Wiley and Sons, 1990.

Report an issue
<< nanstdev Data with Missing Values thrownan >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Oct 01 17:39:48 CEST 2012