hi guys, new to matlab and came across a simple problem that takes me forever to get over. please help.
if rgb(1)==1 if rgb(2)==1 if rgb(3)==1 color='white'; else color='yellow'; end else if rgb(3)==1 color='magenta'; else color='red'; end end else if rgb(1)==1 if rgb(3)==1 color='cyan'; else color='green'; end else if rgb(3)==1 color='blue'; else color='invalid input'; end endend
so its pretty much just mix three primary colors as input and output the mixed color.. i have a hard time going through this and i don't know where i did wrong.. thanks for answering. oh and here's the error:
Attempted to access rgb(3); index out of bounds because numel(rgb)=1.
Error in rgb_color (line 26) if rgb(3)==1
Best Answer