function area = calcarea(rad) ↑ Error: Function definitions are not permitted in this context.
이전 댓글 표시
Hello to all.
I am new to MATLAB and learning from a Book.
I typed this code from Book and save the file as calcarea.m
function area = calcarea(rad)
area = pi*rad*rad;
end
But i am getting this error when I select 'evaluation selection'- "Function definitions are not permitted in this context''.
But when run it i get this error
calcarea
Not enough input arguments.
Error in calcarea (line 2)
area = pi*rad*rad;
Please help me to remove this error
Thanks in advance
답변 (2개)
darova
2020년 4월 23일
0 개 추천
See this simple solution

Sudipto Dutta
2022년 1월 28일
0 개 추천
function area = calcarea(rad)
area = pi*rad*rad;
end
카테고리
도움말 센터 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!