Skip to content

Instantly share code, notes, and snippets.

@mattnworb
Created November 29, 2011 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattnworb/1405216 to your computer and use it in GitHub Desktop.
Save mattnworb/1405216 to your computer and use it in GitHub Desktop.
error in Octave using mean on binary vector
octave-3.4.0:1> a = [ 1 2 3 4]
a =
1 2 3 4
octave-3.4.0:2> mean(a)
ans = 2.5000
octave-3.4.0:3> b = (a == 2)
b =
0 1 0 0
octave-3.4.0:4> mean(b)
error: mean: X must be a numeric vector or matrix
error: called from:
error: /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/statistics/base/mean.m at line 69, column 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment