changing uislider position by script

9 views (last 30 days)
Borshin常
Borshin常 on 19 Jun 2020
Commented: Borshin常on 19 Jun 2020
Hi everyone,
I'm new in using matlab gui,
I found that the function "uislider" can only show horizontal slider no matter what position I tryed.
Is there any ways to change slider to vertical?
Here is a simple script below.
clc;
clear;
closeall;
fig = uifigure('Position',[100 100 350 275]);
cg=0;
sld = uislider(fig,...
'Position'(100 100 100 100),...
'ValueChangingFcn',@(sld, event) sliderMoving(event,cg));
1 Comment
Borshin常
Borshin常 on 19 Jun 2020
Thanks everyone,
I though I solved it.
When object [sld] is created, u can change its attribute like
sld.Orientation = 'vertical';
clc;
clear;
closeall;
fig = uifigure('Position',[100 100 350 275]);
cg=0;
sld = uislider(fig,...
'Position'(100 100 100 100),...
'ValueChangingFcn',@(sld, event) sliderMoving(event,cg));
sld.Orientation ='vertical';

Sign in to comment.

Answers (1)

Tommy
Tommy on 19 Jun 2020
sld = uislider(fig,...
'Orientation','vertical',...
'Position',[ 100 100 3 100],...
'ValueChangingFcn',@(sld, event) sliderMoving(event,cg));

下载188bet金宝搏


Release

R2018a

Community Treasure Hunt

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

Start Hunting!