Change Background color using [row,col]?

2 次查看(过去 30 天)
Ash Lord
Ash Lord 2020-12-17
编辑: Ash Lord 2020-12-17
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]);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by