フィルターのクリア

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