not enough input arguments Error

조회 수: 1 (최근 30일)
Asif Rashid
Asif Rashid 2021년 3월 13일
댓글: Star Strider 2021년 3월 13일
Dear Colleagues and Teachers,
I am eperiencing a code error aginst this code ;
% Function to generate a multi-step custom membership function
% using 8 parameters for the input argument x
function out = custmf1(x,params)
for i = 1:length(x)
if x(i) < params(1)
y(i) = params(1);
elseif x(i) < params(2)
y(i) = params(2);
elseif x(i) < params(3)
y(i) = params(3);
elseif x(i) < params(4)
y(i) = params(4);
elseif x(i) < params(5)
y(i) = params(5);
elseif x(i) < params(6)
y(i) = params(6);
elseif x(i) < params(7)
y(i) = params(7);
elseif x(i) < params(8)
y(i) = params(8);
else
y(i) = 0;
end
end
out = 0.1*y'; % Scale the output to lie between 0 and 1.
end
Can anyone please tell me that how can i remove this error
-----------------------------
Command Window
>>custmf1
Error using custmf1 (line 3)
Not enough input arguments

채택된 답변

Star Strider
Star Strider 2021년 3월 13일
Call it as:
out = custmf1(x,params);
with the arguments stated and in the calling script workspace. Only anonymous functions inherit existing workspace variables. Other functions do not.
  댓글 수: 6
Asif Rashid
Asif Rashid 2021년 3월 13일
i just got back to your kind reply and i got some idea about this statement .
if you can see another question , there the problem statement is for five conditions so can you please comment in that case please. i just ant to execute those 5 statements , please
in the end , i am very oblidged with your kind reply. thankyou and best wishes
Star Strider
Star Strider 2021년 3월 13일
I did, actually, citing my previous Comment here as an example.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by