File Exchange

image thumbnail

Function Parameter Slider

version 1.0.0.1 (11.8 KB) by

Use continuously updating sliders to view how a function changes as its input parameters change

14 Downloads

Updated

View License

funcslider.m
Given a function with several (up to 5) inputs, and several outputs,
[z1, z2, ...] = f(x1,...,x5)

Function Slider lets you vary the input values x1...x5 using continuously updating sliders, and then viewing the results using any arbitrary MATLAB expression on the outputs (z1,z2...).

The input function, output (plotting) function, and slider values/limits are all user settable.

I wrote this with a hard coded limit of 5 sliders in this GUI, but it probably wouldn't be too hard to change this.

The HELP shows several examples that should hopefully make this clear.

Known issues:
There may be some difficulties with trying to keep the view exactly the same when the lock command is checked.

Comments and Ratings (8)

nicokla

On Matlab 2015a, I think there has been a change that make the code need an update to make it work : all the || and the && should be replaced by | and &, because the || and the && raise this error :
Operands to the || and &&
operators must be
convertible to logical
scalar values.
ie, there is a problem when we try to use them on matrices. I made a ctrl/f, then replace all for the && and the || into & and |, and then the code worked perfectly.

Leandro

really easy to use!

I think it is ace and is way beyond anything I could do.

I'm still cheeky enough to suggest some improvements though:

Like Marc, I wanted to edit the default min and max, and found values on lines 921 and 1001, but still needed to click in the box and press enter for them to effect the value that the slider returns.

It'd be great if the context menu of the output plot still worked (so I could check peak response on a step plot for example).

The lock x and y axes buttons didn't seem to work for my plotyy graph.

Still brilliant.

Dan Ellis

Dan Ellis (view profile)

Love it. Did exactly what I wanted, worked first time, I never have to know what the Matlab primitives for sliders are!

Dan Ellis

Dan Ellis (view profile)

Matthew

This works perfectly and is everything I ever dreamed of and more in a function slider. You are my hero.

Marc

Marc (view profile)

Hi Teja,

I'm adapting this for a particular application- working quite well, except I can't figure out how to set different starting minimum, maximum and values for the sliders. Can you point me in the right direction?

Thanks.

Marc

Updates

1.0.0.1

Updated license

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video