필터 지우기
필터 지우기

Plot GUI Color test

조회 수: 1 (최근 30일)
Robin Stengl
Robin Stengl 2019년 12월 9일
편집: Robin Stengl 2019년 12월 10일
Thank yo

답변 (1개)

Ben Cunningham
Ben Cunningham 2019년 12월 9일
Each button has a property 'Background Colour'. You can use a simple state machine to set the colour in [Red, Green, Blue].
See the below code:
properties (Access = private)
ButtonState = 1; % Current Button State
end
% Callbacks that handle component events
methods (Access = private)
% Value changed function: Button
function ButtonValueChanged(app, event)
value = app.Button.Value;
switch app.ButtonState
case 1
app.Button.BackgroundColor = [1.00,0.00,0.00];
app.ButtonState = 2;
case 2
app.Button.BackgroundColor = [0.00,1.00,0.00];
app.ButtonState = 3;
case 3
app.Button.BackgroundColor = [0.00,0.00,1.00];
app.ButtonState = 1;
end
end
end
  댓글 수: 1
Robin Stengl
Robin Stengl 2019년 12월 9일
Hey Ben Cunningham,
thank you very much for your help. But matlab publishes the follwoing mistake:
Error: File: finallasttry.m Line: 1 Column: 20
Incorrect use of '=' operator. To assign a value to a variable, use '='. To compare values for equality, use
'=='.
What can I do that it works
Kind regards
Robin

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by