필터 지우기
필터 지우기

"Not enough input arguments" in a function, variables are in workspace. Any help please?

조회 수: 1 (최근 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
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
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
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
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.
  댓글 수: 2
Brian
Brian 2013년 5월 4일
Thanks for the reply. I got "[dl,bt]=decsg(gd,sf,ns)" from the mathworks.co.uk page. It is already written by them so it shouldn't need anything else. The laptop I am working on this minute doesn't have decsg function installed and it's still the exact same message,
>>test_DistFnc
Error using test_DistFnc (line 9)
Not enough input arguments.
(line 9 is the right line). I haven't written a use for dl yet but that shouldn't matter. Cheers
Brian
Brian 2013년 5월 4일
In case you haven't used it, decsg takes information from the PDE toolbox, and outputs decomposed geometry (dl) and a table of 1s and 0s (bt) which tells the connection between them (if one is a null area etc)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by