function area = calcarea(rad) ↑ Error: Function definitions are not permitted in this context.
Afficher commentaires plus anciens
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
Réponses (2)
darova
le 23 Avr 2020
0 votes
See this simple solution

Sudipto Dutta
le 28 Jan 2022
0 votes
function area = calcarea(rad)
area = pi*rad*rad;
end
Catégories
En savoir plus sur Statistics and Machine Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!