Put a set values to slider in Matlab Guide

조회 수: 10 (최근 30일)
Jonasz
Jonasz 2013년 8월 18일
I want to put a set of values to my slider in Matlab Gui so it will be able to discreetly go through these values.
eg. Numbers written in x variable will be presented on the slider ( only these numbers)
How to do it in Matlab Guide?

답변 (1개)

Image Analyst
Image Analyst 2013년 8월 18일
편집: Image Analyst 2013년 8월 18일
You can set the max and min and value of the slider using the set function:
set(handles.slider1, 'value', someValue);
but it won't display. To do that you need to place a static text label near the slider (say, above it). Then set the string value of the label:
caption = sprintf('Slider value = %.3f', someValue);
set(handles.sliderLabel, 'String', caption);
  댓글 수: 3
Image Analyst
Image Analyst 2013년 8월 18일
What do you want your label to look like? Just use sprintf() to build it up however you want it.
Jonasz
Jonasz 2013년 8월 18일
I will be only one number but how the slider know what number to display and the range etc?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by