This statement is not inside any function.
显示 更早的评论
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".)
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Adding custom doc 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!