"Not enough input arguments" in a function, variables are in workspace. Any help please?
2 次查看(过去 30 天)
显示 更早的评论
I couldn't find anything like this on the forum. Sorry, this is basic. The variables are in the woekspace. The code is:
function [Dist, BdBox] = test_DistFnc(P,gd,sf,ns)
C = zeros(10,2);
h = 0;
q=0;
[dl, bt] = decsg(gd,sf,ns); Error using test_DistFnc
Not enough input arguments.
Any help would be greatly appreciated, thanks
2 个评论
per isakson
2013-5-4
Which is the relation between the function,
test_DistFnc
and the call
[dl, bt] = decsg(gd,sf,ns);
???
Image Analyst
2013-5-4
Brian, you forgot to post the entire error message. You just clipped out small, and unfortunately useless, portions of it. Please post everything you see in red text.
采纳的回答
Walter Roberson
2013-5-4
When you give the command
test_DistFnc
you must follow it by 4 input arguments on the command line. You have not done that.
When you have a function with arguments in the "function" line, then MATLAB will not automatically use variables of that name that are in the caller's workspace or the base workspace: the values must be passed specifically.
更多回答(1 个)
Jan
2013-5-4
How many input arguments are required for decsg? The partially shown error message could appear, if this function needs more than 3 inputs.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!