Changing the value of slider with editfield and vice versa

17 views (last 30 days)
I am new to appdesigner. And I don't know how to change the value of the slider/knob using EditField numerical values while I can still use the slider/knob to change my EditField value.
  1 Comment
Nikhil Sapre
Nikhil Sapre on 1 Jul 2021
Check this example and use of ValueChangedFcn specifically.
This example changes a gauge value when the slider is changed. Replace the gauge with your EditField ui component.

Sign in to comment.

Answers (1)

Luis Domenianni
Luis Domenianni on 30 Aug 2022
Hi, I was looking for something else and I stumped on this, it is probably too late but the answer might help someone else.
A simple way would be to add a value changed callback to your slider and return your edit field value
function xSliderValueChanged(app, event)
app.EditField.Value = app.Slider.Value;
end
And viceversa on the edit field
function xpositionEditFieldValueChanged(app, event)
app.Slider.Value = app.ditField.Value;
end
Hope it helps someone!

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!