필터 지우기
필터 지우기

Switch function to toggle between radio button

조회 수: 5 (최근 30일)
Lucia Wagner
Lucia Wagner 2020년 6월 15일
댓글: Lucia Wagner 2020년 6월 22일
Hello MATLAB community,
I am trying to develop code in App Designer that, when the spacebar is pressed, toggles between either "ADD" or "DELETE." Here is my current code:
case 32 % code for spacebar
app.AddorDeletePointButtonGroup
switch app.PointModeSelected
case 1
set(app.ADDButton, 'Value', 1);
case 2
set(app.DELETEButton, 'Value', 1);
end
I do not know how to proceed. I assume there is an "if" statement that goes somewhere, but I'm not sure where.
Any help or suggestions would be quite useful! This code is listed under the "UIFigureKeyRelease" section in my app.
Thanks!
Lucy

답변 (1개)

Harsha Priya Daggubati
Harsha Priya Daggubati 2020년 6월 18일
Hi Lucia,
I can think of an approach, where you can use a flag to highlight add/delete button. Let's say you initialise flag with 0, then under your 'case 32', if flag equals 0, you can highlight add button and make flag 1, Similarly you can hightlight delete if flag equals 1 and make flag 0. I suggest declaring this flag as a property in your code.
Hope this helps!
  댓글 수: 1
Lucia Wagner
Lucia Wagner 2020년 6월 22일
Hi Harsha,
Thanks for your help! Actually the problem was I was missing the get() function around an if statement, but I appreciate you taking the time to respond.

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

카테고리

Help CenterFile Exchange에서 Spectral Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by