how to use "range" in uislider

fig = uifigure;
s = uislider(fig,"range",1:50);
Error using uislider
Unrecognized property range for class Slider.
Error in untitled6 (line 2)
s = uislider(fig,"range",1:50);
i want this :

9 Comments

Stephen23
Stephen23 on 18 May 2024
Edited: Stephen23 on 18 May 2024
Note that the "range" option is only supported since R2023b:
Presumably you are using an earlier version.
thank...but it's possible to write the chosen values ​​under the button?
Overlay an AXES object, add two TEXT objects, modify their positions in the slider callbacks.
Are you sure that i can change position in label (text object) ?
K>> app.Label.Position
ans =
121.5185 671.4138 17.6296 13.5862 => this a label position
K>> app.Label.Position=[121.5185 671.4138 17.6296 13.5862] => i try to change it but it does not work
Warning: Unable to set 'Position', 'InnerPosition', or 'OuterPosition' for components in 'GridLayout'.
Of course TEXT objects have a writeable POSITION property:
TEXT objects do not have a LABEL property.
shamal
shamal on 19 May 2024
Edited: shamal on 19 May 2024
excuse but i don't undertand your esample
I want to know information about position in "1" and "2"
the only information I have is:
app.FilerTimeRange_Slider
IF I USE YOUR EXAMPLE
t = text(0.5,0.5,'text here');
s = t.FontSize;
t.FontSize = 12;
it creates a new figure for me and it's not good
"I want to know information about position in "1" and "2""
You want the VALUE property.
"it creates a new figure for me and it's not good"
Specify an existing figure as the parent. Even better: create axes first, exactly as I wrote in my earlier comment.
shamal
shamal on 19 May 2024
Edited: shamal on 19 May 2024
From my knowledge it's a bit difficult.. Here I made a reply to my problem (matlab_test.mlapp).. Can you edit the attached file with the solution? Thank you
From my knowledge it's a bit difficult."
Certainly it would be quite fiddly to implement.
A simpler approach is to have some fixed (i.e. unmoving) e.g. UICONTROL displaying the values.

Sign in to comment.

Answers (1)

Voss
Voss on 18 May 2024

2 Comments

shamal
shamal on 18 May 2024
Edited: shamal on 18 May 2024
it's not correct..
I want double button to fix limit
see pics above
s = uislider(fig,"range","Limits",[1 50]);

Sign in to comment.

Categories

Asked:

on 17 May 2024

Commented:

on 20 May 2024

Community Treasure Hunt

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

Start Hunting!