MATLAB:what's the mean of empty vector?
14 views (last 30 days)
Show older comments
what's the mean of empty vector?
2 Comments
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.
Accepted Answer
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
0 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!