필터 지우기
필터 지우기

Why do i keep getting the illegal error us of "end"

조회 수: 1 (최근 30일)
Sierra Bounds
Sierra Bounds 2019년 2월 20일
편집: Stephen23 2019년 2월 20일
eaas3.PNG
  댓글 수: 1
Stephen23
Stephen23 2019년 2월 20일
편집: Stephen23 2019년 2월 20일
'Why do i keep getting the illegal error us of "end"'
Check the spelling of "function".

댓글을 달려면 로그인하십시오.

채택된 답변

Asad Mirza
Asad Mirza 2019년 2월 20일
For every start of a loop you write in MATLAB you must "end it" with an "end". They come in pairs.
Now it looks like you did properly close your loop but you incorrectly wrote "funcion" instead of "function", that is where you error it actually coming from.
function vari = variance(a)
total = sum(a);
width = length(a);
avg = total/width;
v=0;
for c = 1 : legnth(a)
v = v +(a(c)-avg)^2;
end
vari = v / (width-1);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by