mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Move test fixtures to samples/
This commit is contained in:
9
samples/matlab/average.m
Normal file
9
samples/matlab/average.m
Normal file
@@ -0,0 +1,9 @@
|
||||
function y = average(x)
|
||||
% AVERAGE Mean of vector elements.
|
||||
% AVERAGE(X), where X is a vector, is the mean of vector
|
||||
% elements. Nonvector input results in an error.
|
||||
[m,n] = size(x);
|
||||
if (~((m == 1) | (n == 1)) | (m == 1 & n == 1))
|
||||
error('Input must be a vector')
|
||||
end
|
||||
y = sum(x)/length(x);
|
||||
Reference in New Issue
Block a user