How do I create a function without getting this Error: Function definitions are not permitted in this context?
显示 更早的评论
I'm trying to create this function, and I am getting an error. I don't know what I am doing wrong...
>> function [y] = myfunc( x, y, z )
y = -9*x - 10*y+ z*(-log(100-x-y)-log(x)-log(y)-log(50-x+y));
end
function [y] = myfunc( x, y, z )
↑
Error: Function definitions are not permitted in this context.
采纳的回答
更多回答(1 个)
KSSV
2017-3-22
0 个投票
I guess you have copied this under some already existing code. Copy this in fresh m file and save.
类别
在 帮助中心 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!