Too many output arguments help

조회 수: 1(최근 30일)
Conner Carriere
Conner Carriere 2021년 2월 8일
편집: Matt J 2021년 2월 8일
I created a function I am trying to call,
MwC = ColorID(MwC);
This is MwC
MwC =
229 250 246
252 116 13
0 255 109
0 6 217
235 255 254
254 0 0
254 0 0
254 0 0
254 254 43
Here is my function called ColorID
function ColorID(~)
ColorIdent = zeros(9,3);
for w = 1: size(ColorIdent,1)
if [(ColorIdent(w,1) <= 255),(ColorIdent(w,2) <= 20),(ColorIdent(w,3) <= 20)] %Red limits
ColorIdent(w,:) = [1 0 0]; %Red
elseif [(ColorIdent(w,1) >= 240),((ColorIdent(w,2) >= 50) && (ColorIdent(w,2) <= 146)),(ColorIdent(w,3) <= 100)] %Orange limits
ColorIdent(w,:) = [1 0 1]; %Orange but had to use magenta
elseif [(ColorIdent(w,1) <= 20),(ColorIdent(w,2) <= 20),(ColorIdent(w,3) <= 255)&&(ColorIdent(w,3) >= 0)] %Blue limits
ColorIdent(w,:) = [0 0 1]; %Blue
elseif [(ColorIdent(w,1) <= 46),(ColorIdent(w,2) >= 200),(ColorIdent(w,3) <= 150)&&(ColorIdent(w,3) >= 80)] %Green limits
ColorIdent(w,:) = [0 1 0]; %Green
elseif [(ColorIdent(w,1) >= 190),(ColorIdent(w,2) >= 229),(ColorIdent(w,3) >= 233)] %White limits
ColorIdent(w,:) = [1 1 1]; %White
elseif [(ColorIdent(w,1) >= 215),(ColorIdent(w,2) >= 230),(ColorIdent(w,3) <= 140)] %Yellow limits
ColorIdent(w,:) = [1 1 0]; %Yellow
end
end
end
Could someone please help me and explain why the error is happening?

채택된 답변

Matt J
Matt J 2021년 2월 8일
편집: Matt J 2021년 2월 8일
Your function needs to be told what to return, e.g.,
function ColorIdent = ColorID(~)

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by