gui slider disappears from figure

13 views (last 30 days)
Mads
Mads on 14 Jun 2017
Commented: Adam on 14 Jun 2017
I have a script that when runs opens a gui. It has several sliders.
When I run the script with one particular input everything works fine.
When I run the script with another input one particular slider disappears once I start to assign entries to its handle, fx.:
set(slider,'Min',1)
I have followed this in debug mode, and I see that it is still supposed to be Visible (this entry is stil 'on')! It could be another entry that I change, and then it disappears. Also the position remains correct.
But as I said, if the input to the script is another, the troubled slider remains and works as it should.
According to another thread: I do set the units before the position...

Accepted Answer

Adam
Adam on 14 Jun 2017
Problems with sliders disappearing usually come with a warning on the command line and are often associated with setting an illegal state where the min > max or the value does not fit within the specified range.
The fact you say this happens after
set(slider,'Min',1)
indicates this is the problem if e.g. max is 0.
When you are editing the min, max and value properties of a slider it is best to edit these all in one statement as e.g.
set( slider, 'Min', 1, 'Max', 2, 'Value', 1.5 )
and ensure that the min, max and value are valid with respect to each other.
  2 Comments
Mads
Mads on 14 Jun 2017
Adam, you were right about the max value being wrong. To compact three set()'s into one didn't help though. So it works again now. Thanks!
Adam
Adam on 14 Jun 2017
No, setting all 3 at once will not help if they are not valid with respect to each other, but it does eliminate warnings being spewed to command line if you do them in succession and the slider is temporarily in an invalid state mid-way through.

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!