Change Background color using [row,col]?

3 ビュー (過去 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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by