Change Background color using [row,col]?

6 visualizaciones (últimos 30 días)
Ash Lord
Ash Lord el 17 de Dic. de 2020
Editada: Ash Lord el 17 de Dic. de 2020
Hi Everyone,
I'm trying to use [row,col] to find values between a certain range and then use get/set to set those values to different colors. Does anyone know how to fix this so that it works? I can't use uistyle. I'm working in matlab 2019b. Thanks in advance!
Edit i'm getting this error:
Error Using GUI after first time - "Error using handle.handle/set Invalid or deleted object."
% Threshold 1 (green)
[row,col] = find(uit.Data >= 0 & uit.Data < 43);
gr = get([row,col],'BackgroundColor');
set(gr,'BackgroundColor',[0 0.5 0]);
% Threshold 2 (yellow)
[row,col] = find(uit.Data >= 43 & uit.Data <= 44);
yel = get([row,col],'BackgroundColor');
set(yel,'BackgroundColor',yellow);
% Threshold 3 (red)
[row,col] = find(uit.Data == 45);
re = get([row,col],'BackgroundColor');
set(re,'BackgroundColor',red);
% Threshold 4 (black)
[row,col] = find(uit.Data == 0);
bl = get([row,col],'BackgroundColor');
set(bl,'BackgroundColor',[0.9 0.9 0.9]);

Respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by