Using a custom color array. "Color value must be a 3 element vector".
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!