Info

This question is closed. Reopen it to edit or answer.

HELP! "Error: Function definitions are not permitted in this context."

1 view (last 30 days)
I'm brand new to Matlab, and barely know what I'm doing. I'm doing this homework in a Word document and running it as a MatLab Notebook. The function I'm trying to run is:
function Volume = tankvolume(d,R) if d <= R Volume = pi * d ^ 3 / 3; elseif d <= 3*R Volume = pi * R ^ 3 / 3 + pi * R ^ 2 * (d - R); else Volume = 'Overtop'; end
When run in MatLab itself, it works fine with no issues. However, when I try to Evaluate it in the Notebook, I get the error about function definitions not being permitted. I could really use an explanation about what I'm doing wrong or missing. Thanks.

Answers (0)

Community Treasure Hunt

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

Start Hunting!