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!