Too many output arguments help

1 vue (au cours des 30 derniers jours)
Conner Carriere
Conner Carriere le 8 Fév 2021
Modifié(e) : Matt J le 8 Fév 2021
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?

Réponse acceptée

Matt J
Matt J le 8 Fév 2021
Modifié(e) : Matt J le 8 Fév 2021
Your function needs to be told what to return, e.g.,
function ColorIdent = ColorID(~)

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by