This statement is not inside any function.
Show older comments
function sumVector = computeSum(vector)
sumVector = 0;
for i = 1:length(vector)
sumVector = sumVector + vector(i);
end
end
V = 1:10;
totalSum = computeSum(V);
disp(['Sum of elements in vector V is ' num2str(totalSum)]);
Error: File: computeSum.m Line: 9 Column: 1
This statement is not inside any function.
(It follows the END that terminates the definition of the function "computeSum".)
Accepted Answer
More Answers (0)
Categories
Find more on Adding custom doc 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!