MATLAB:what's the mean of empty vector?

14 views (last 30 days)
Lan
Lan on 15 Mar 2015
Commented: Lan on 16 Mar 2015
what's the mean of empty vector?
  2 Comments
Stephen23
Stephen23 on 15 Mar 2015
This vector has two elements:
[1,2]
This vector has one element:
[1]
This vector has no elements:
[]
Therefore it is empty.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 15 Mar 2015
Edited: Star Strider on 15 Mar 2015
A vector with no elements in it. You can create one:
v = [];
or, if the result of an operation, for instance find, has no dlements in an argument vector that meet the logical conditions in it, it will return an empty vector:
v = [1 2 3 4];
f = find(v > 4);
produces:
f =
Empty matrix: 1-by-0
If you’re talking about the arithmetic mean:
m = mean(f)
the answer is:
m =
NaN

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!