1

I created a slider using uicomponent which can be found on File Exchange

handles.slid=uicomponent('style','slider',0,90,5);
handles.slid.MajorTickSpacing=10;
handles.slid.MinorTickSpacing=10;
handles.slid.Paintlabels=1;
handles.slid.PaintTicks=1;

The labels were initially set as 0 10 20 30 40 50 60 70 80 90

Is it possible to set the labels as a b c d e f g h i j?

slayton
  • 20,123
  • 10
  • 60
  • 89
Cleiton
  • 271
  • 2
  • 5
  • 14
  • Its not an exact duplicate, but this questions might have part of what you are looking for http://stackoverflow.com/questions/6697780/java-jslider-set-values – slayton Sep 13 '12 at 03:59

1 Answers1

2

You will have to use Java for that. The simplest way I can think of is to modify the existing LabelTable of the JSlider Java component you have already created. Try the following code:

labels = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
lt =get(hu_slider, 'LabelTable');
for i=1:10
    key = java.lang.Integer(10*(i-1));
    val = lt.get(key);
    val.setText(labels{i});
    lt.put(key, val);
end
set(hu_slider, 'LabelTable', lt);
hu_slider.JavaComponent.updateUI;

It works with the assumption that you have 10 ticks, of course.

angainor
  • 11,760
  • 2
  • 36
  • 56