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 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by