Change Background color using [row,col]?

조회 수: 15 (최근 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