Indexing Error: Index in position 1 exceeds array bounds (must not exceed 1) in For loop

1 visualización (últimos 30 días)
Hello,
I am trying to add color to the rows in my UI Table in the GUI, but I am getting this error
"Index in position 1 exceeds array bounds (must not exceed 1)."
This is my code
AssemblyData= {'Name1',0, 0};
AssemblyTable= uitable(f, 'Units', 'centimeters','Position', [1,1,9,5], 'Data', AssemblyData,'ColumnEditable',[false, true, true], 'ColumnName',{'Name'; 'Offset w.r.t FirstBody[m]';'MeshSize[m]'},'CellEditCallback', {@AssemblyEdit_Callback});
data1 = get(AssemblyTable, 'data'); % pic is attached above
b =[0 0 0;1 0 1; 0 1 1;1 0 0;0 1 0;0 0 1;1 1 1;0 0 0;1 1 0; 1 0 1; 0 1 1;1 0 0;0 1 0;0 0 1;1 1 1;0 0 0;1 1 0; 1 0 1; 0 1 1;1 0 0;0 1 0;0 0 1;1 1 1;0 0 0;1 1 0; 1 0 1; 0 1 1;1 0 0;0 1 0;0 0 1;1 1 1;0 0 0]
for up =1:size(data1,1)
set(AssemblyTable(up,1),'ForegroundColor',b(up,: ))
end
I dont know why i am getting this error..
Does anyone know?
  5 comentarios
Chris Dan
Chris Dan el 29 de Jul. de 2020
It works now,
I changed the intensity to less value, now it works
Maybe you have some different solution?
Geoff Hayes
Geoff Hayes el 1 de Ag. de 2020
You could probably change the foreground colour (the colour of the text) to white or some other colour that is distinct from the set of colours in your cells.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by