- Select the slider within the App Designer Design View.
- Navigate to the "Slider & Label Properties" menu on the right side of the App Designer.
- Click the "Callbacks" tab of the "Slider & Label Properties" menu.
- Enter a callback function name for the "ValueChanging" event (let's assume you call the function "updatePlot").
- Implement the callback function ("updatePlot") for the slider's "ValueChanging" event within the App Designer Code View.
Quick question about appDesigner - need an example
1 次查看(过去 30 天)
显示 更早的评论
I've been using Matlab for a very long time, but I've never bothered with building any GUIs with it. So now I'm just dipping my toes into appDesigner. And as a trial, I thought I'd make a simple app with two sliders (for x and y coordinates) and some axes, on which would be drawn a circle with radius 1 and center given by the sliders. I think I've got all the bits, but they aren't talking to each other: I don't know that my circle plotting function is picking up the values from the sliders, or that the plot is being sent to the axes. At any rate, nothing is being drawn.
What I want is some more examples than the ones provided: in particular an example of an app, built with appDesigner, in which a plot changes in response to a slider.
Can anybody point me in the direction of one such?
Thanks!
0 个评论
回答(1 个)
Kevin Gurney
2016-11-2
编辑:Kevin Gurney
2016-11-2
My understanding is that you would like a simple example of an App Designer application that contains a plot which responds to changes in a slider.
This functionality can be achieved using the basic workflow outlined below:
The implementation of the callback function ("updatePlot") for the "ValueChanging" event could be something as simple as:
function updatePlot(app, event)
plot(app.UIAxes, event.Value, event.Value, 'bo');
end
The code above will set the x and y coordinates of a blue circle on a plot to the value of the slider as it is changed by the user.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!