필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

I am writing code to create a GUI, so How do I set slider values to change RGB axes values?

조회 수: 1 (최근 30일)
Me
Me 2022년 11월 18일
마감: Steven Lord 2022년 11월 18일
I am writing code to create a GUI.
The guidelines are as listed:
So first, open up App Designer in Matlab.
Then create a new GUI and in the “Design View” tab, place all the components for the GUI
  • 3 Sliders
  • 1 Axis
  • 1 Button
  • 1 Label
  • Add a CallBack function for the Button
Next, go to the “Code View” tab, and add the code for the Button callback function so that the background color of the Axes changes based on the value of the sliders AND the values of the sliders are printed. This callback function will be executed when the Update Color Button is pushed.
  • The values from the sliders can be saved as variables by storing the “.Value” property
  • The color of the axes can be changed by setting the “.Color” property to the RGB values from the sliders
  • Use the sprintf function to print the values for R, G and B to the Label component by setting the .Text property. The sprintf function works very similar to fprintf -- but instead of printing to the Command Window, sprintf prints to a char Array variable.
I followed these guidelines and have the Design View of:
and a Code View of:
It is not working and I am unsure how to set the values of the sliders to ensure that they change the axes background color. Help would be greatly appreciated. Thank you for yor time!
  댓글 수: 4
Me
Me 2022년 11월 18일
편집: Me 2022년 11월 18일
Sorry, I noticed you said use callback of the sliders. If I were to do that, what information would need to be present in those sliders? Would each slider need to be set to app.UIAxes.BackgroundColor = [RVal, GVal, BVal]? The guidelines instruct me to use the button callback to change the background color and print to the label. Would I instead set each value of the slider within each slider's callback?
Jan
Jan 2022년 11월 18일
Sorry, I've struggled to much with the tiny screenshots. No, do not use thecallbacks of the sliders, but the callbacl of the button. Currently you have com code in the UIFigureButtonUp callback, but this is not useful.

답변 (0개)

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by