# Scale Slider

**URL:** <https://psychtoolbox.discourse.group/t/scale-slider/146>\
**Category:** Uncategorized\
**Created:** [November 25, 2016, 2:53pm UTC](https://psychtoolbox.discourse.group/t/scale-slider/146 "2016-11-25T14:53:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![wdedoncker93](https://avatars.discourse-cdn.com/v4/letter/w/a587f6/32.png) [@wdedoncker93](https://psychtoolbox.discourse.group/u/wdedoncker93)\
**Post date:** [November 25, 2016, 2:53pm UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/1 "2016-11-25T14:53:42Z")

</div>

Hi there,

I am just wondering whether it is possible to create a Scale Slider in PTB, just like you can using the GUI interface in MatLab.

I want to measure confidence on a scale of 1 to 10 using a scale slider following a response to a stimulus, with the participants able to see the value of their response on the scale.&nbsp;

Any suggestions as to how best to do this would be very much appreciated.

Best,

Will

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [November 25, 2016, 9:40pm UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/2 "2016-11-25T21:40:58Z")

</div>

Hi there,   
  
I actually wrote a code snippet to do exactly this, based on someone else's code I found online. It wouldn't be hard to turn this into a function that returns a value.   
  
You can make the values anything you like, and the text anything you like - should be fairly obvious.   
  
Hope this helps!   
  
Cheers  
  
Deborah.  
  
  
  
[wdedoncker93@...](mailto:wdedoncker93@...) [PSYCHTOOLBOX] wrote:  

> > Hi there,
> > 
> > I am just wondering whether it is possible to create a Scale Slider in PTB, just like you can using the GUI interface in MatLab.
> > 
> > I want to measure confidence on a scale of 1 to 10 using a scale slider following a response to a stimulus, with the participants able to see the value of their response on the scale.
> > 
> > Any suggestions as to how best to do this would be very much appreciated.
> > 
> > Best,
> > 
> > Will
> 
>   
> 
> --   
> 
> Deborah Apthorp  
> NHMRC Early Career Fellow  
> Research School of Psychology  
> Australian National University  
> ACT 2601  
>    
> ph. (02) 6125 9631

---

<div class="post-metadata">

**Author:** ![wdedoncker93](https://avatars.discourse-cdn.com/v4/letter/w/a587f6/32.png) [@wdedoncker93](https://psychtoolbox.discourse.group/u/wdedoncker93)\
**Post date:** [November 28, 2016, 11:23am UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/3 "2016-11-28T11:23:27Z")

</div>

Hi Deborah,
  

Thank you very much for that! Some minor alterations and that should do exactly what I want it to do.

  

Once again thank you for your help.

  

Cheers,

  

Will

---

<div class="post-metadata">

**Author:** ![remigau82](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@remigau82](https://psychtoolbox.discourse.group/u/remigau82)\
**Post date:** [November 28, 2016, 3:21pm UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/4 "2016-11-28T15:21:23Z")

</div>

Hey all,

Not directly PTB related but since sliders were mentionned, I think this is worth having a look at.

The Effect of Visual Appearance on the Performance of Continuous Sliders and Visual Analogue Scales

[https://www.youtube.com/watch?v=vxV0rV9LX\_U](https://www.youtube.com/watch?v=vxV0rV9LX_U)

Best  
  
Remi  
  
  

On 25/11/16 21:40, Deborah Apthorp [deborah.apthorp@...](mailto:deborah.apthorp@...) [PSYCHTOOLBOX] wrote:  

> > Hi there,  
> >    
> > I actually wrote a code snippet to do exactly this, based on someone else's code I found online. It wouldn't be hard to turn this into a function that returns a value.  
> >   
> > You can make the values anything you like, and the text anything you like - should be fairly obvious.  
> >   
> > Hope this helps!   
> >   
> > Cheers  
> >   
> > Deborah.  
> >   
> >   
> >   
> > [wdedoncker93@...](mailto:wdedoncker93@...) [PSYCHTOOLBOX] wrote:  
> > 
> > > &nbsp;
> > > 
> > > Hi there,
> > > 
> > > I am just wondering whether it is possible to create a Scale Slider in PTB, just like you can using the GUI interface in MatLab.
> > > 
> > > I want to measure confidence on a scale of 1 to 10 using a scale slider following a response to a stimulus, with the participants able to see the value of their response on the scale.&nbsp;
> > > 
> > > Any suggestions as to how best to do this would be very much appreciated.
> > > 
> > > Best,
> > > 
> > > Will
> > 
> >   
> > 
> > --   
> > 
> > Deborah Apthorp  
> > NHMRC Early Career Fellow  
> > Research School of Psychology  
> > Australian National University  
> > ACT 2601  
> >    
> > ph. (02) 6125 9631

---

<div class="post-metadata">

**Author:** ![wdedoncker93](https://avatars.discourse-cdn.com/v4/letter/w/a587f6/32.png) [@wdedoncker93](https://psychtoolbox.discourse.group/u/wdedoncker93)\
**Post date:** [November 28, 2016, 2:13pm UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/5 "2016-11-28T14:13:41Z")

</div>

Hi Deborah,
  

Sorry again, I am relatively new to PTB and trying to get a protocol running. Any suggestions as to how I could get the value returned and displayed on the screen while someone is moving the scale slider along the line?

  

Thanks for the help,

  

Will

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [November 29, 2016, 6:58am UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/6 "2016-11-29T06:58:40Z")

</div>

Hi Will,   
  
OK, here is some slightly updated code that includes the current rating displayed on the screen. You really just needed 2 extra lines: one to work out the current rating, and one to display the text on the screen:   
  
 currentRating = ((LineX - xCenter) + 250)/50; % for a rating of between 0 and 10. Tweak this as necessary.  
DrawFormattedText(w, num2str(currentRating) ,'center', (yCenter-200), textColor, [],[],[],5); % display current rating (to make this display whole numbers, use "round(currentRating)"  
  
But I made the code a bit nicer so you can enter your own instructions and anchors for the scale at the top.   
  
Cheers!  
  
Deborah.  
  
  
  
[wdedoncker93@...](mailto:wdedoncker93@...) [PSYCHTOOLBOX] wrote:  

> > Hi Deborah,
> > 
> >   
> > 
> > Sorry again, I am relatively new to PTB and trying to get a protocol running. Any suggestions as to how I could get the value returned and displayed on the screen while someone is moving the scale slider along the line?
> > 
> >   
> > 
> > Thanks for the help,
> > 
> >   
> > 
> > Will
> 
>   
> 
> --   
> 
> Deborah Apthorp  
> NHMRC Early Career Fellow  
> Research School of Psychology  
> Australian National University  
> ACT 2601  
>    
> ph. (02) 6125 9631

---

<div class="post-metadata">

**Author:** ![wdedoncker93](https://avatars.discourse-cdn.com/v4/letter/w/a587f6/32.png) [@wdedoncker93](https://psychtoolbox.discourse.group/u/wdedoncker93)\
**Post date:** [November 29, 2016, 5:30pm UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/7 "2016-11-29T17:30:35Z")

</div>

Deborah,&nbsp;
  

You are a legend! That works perfect, thank you very much for all your help.&nbsp;

  

Cheers,

  

Will

---

<div class="post-metadata">

**Author:** ![mbreshock](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mbreshock](https://psychtoolbox.discourse.group/u/mbreshock)\
**Post date:** [September 2, 2020, 3:15am UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/8 "2020-09-02T03:15:21Z")

</div>

Hi Deborah,

I know its been awhile since you originally posted this but I’m looking for a similar function as Will described. For some reason I am unable to see the code you shared so I was wondering if you wouldn’t mind posting it again or sharing privately? Thanks!

Cheers  
Michael

---

<div class="post-metadata">

**Author:** ![AntoniaSchumann](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@AntoniaSchumann](https://psychtoolbox.discourse.group/u/AntoniaSchumann)\
**Post date:** [January 27, 2021, 9:48am UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/9 "2021-01-27T09:48:50Z")

</div>

Hey Deborah,

I know this is quite some time ago, but I’d be very interested in the code as well since I want to implement a continuous scale in my experiment. Is there any way you could the lines again?

Best,  
Antonia

---

<div class="post-metadata">

**Author:** ![Eniluap](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@Eniluap](https://psychtoolbox.discourse.group/u/Eniluap)\
**Post date:** [April 26, 2021, 4:56pm UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/10 "2021-04-26T16:56:32Z")

</div>

Hi there,  
Same question. Would you be able to share that code?  
Thanks  
Pauline

---

<div class="post-metadata">

**Author:** ![Ian-Max-Andolina](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/ian-max-andolina/32/4_2.png) [@Ian-Max-Andolina](https://psychtoolbox.discourse.group/u/Ian-Max-Andolina)\
**Post date:** [April 27, 2021, 6:31am UTC](https://psychtoolbox.discourse.group/t/scale-slider/146/11 "2021-04-27T06:31:23Z")

</div>

It is probable that Deborah Apthorp doesn’t read this forum, so you should try to contact her directly to share her code again, ideally re-uploading it here so others can use it…

> **[Deborah Apthorp](https://www.deborahapthorp.com)**
>
> Deborah Apthorp's personal website
