Not enough input arguments.

조회 수: 2 (최근 30일)
Jessica Larry
Jessica Larry 2020년 4월 29일
댓글: Jessica Larry 2020년 4월 30일
L = data(:,3); %this is the length/value of each item
for k = 1:length(P)
item.test(k) = tolerance(item.cat(k),L(k));
end
%%
%functions
function [fit] = tolerance(category,value)
if category == 1
if value>=25.1 && value<=26.05
fit = 55;
else
fit = 99;
end
elseif category == 2
if value>=25.92 && value<=26.08
fit = 55;
else
fit = 99;
end
elseif category == 3
if value>=25.88 && value<=26.12
fit = 55;
else
fit = 99;
end
else
if value>=25.85 && value<=26.15
fit = 55;
else
fit = 99;
end
end
end
I have a strcuture field called (item.cat) which is the category of 4 items (1-4) and the user defined function I made is supposed to go through all of the values in the structure field and determine if each item fits the specific tolerences based on its category. However I keep getting the ERROR
Not enough input arguments.
Error in tolerance (line 2)
if category == 1
what does it mean by not enough inputs? I'm trying to determine if the value in the matrix is in category 1,2,3 or 4 so wouldn't the only input be the category which in this case is the structure field 'item.cat'?
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 4월 29일
If that error message is complete, then you are attempting to run your tolerance function by itself instead of running your script.
Jessica Larry
Jessica Larry 2020년 4월 30일
Ok thanks!

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

답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by