MATLAB: Using a custom color array. “Color value must be a 3 element vector”.

colorguiguideMATLABplotting

I have a GUI with various graphs. Here is a function that plots values onto one of the graphs. The function below works if colVal = ['r', 'y', 'k'….etc.], but once I try to use raw color values, I receive the error "Color value must be a 3 element vector. As far as I can tell, each cell contains 3 elements. What am I doing wrong? Any help is appreciated.
function L1_lineDisplay(radioStatus, handles)
% radioStatus - a 12x1 binary vector indicating which electrode pairs are
% selected and which are not
% handles - handle obj from the gui
ind1 = find(radioStatus(1:6) == 1);
colVal = {[0 0.4470 0.7410],...
[0.8500 0.3250 0.0980],...
[0.9290 0.6940 0.1250],...
[0.4940 0.1840 0.5560],...
[0.4660 0.6740 0.1880],...
[0.3010 0.7450 0.9330]}
% Prepare the x and y lines for each electrode pair
xlines = handles.xlines;
ylines = handles.ylines;
% Plot the lines for the active electrodes
set(gcf,'CurrentAxes', handles.lead1_ax);
set(gcf,'Renderer','painters');
for i = 1:length(ind1)
line(xlines(:,ind1(i)), ylines(:,ind1(i)), 'Color', colVal(ind1(i)),'linewidth', 3); hold on;
end
end

Best Answer

Try
colVal{ind1(i)}
instead. That will be the contents of the cell, which is the 1x3 array you intended (rather than the cell itself).