File Exchange

image thumbnail

Function Parameter Slider

version 1.0.0.1 (11.8 KB) by Teja Muppirala
Use continuously updating sliders to view how a function changes as its input parameters change

9 Downloads

Updated 01 Sep 2016

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.

Cite As

Teja Muppirala (2020). Function Parameter Slider (https://www.mathworks.com/matlabcentral/fileexchange/28076-function-parameter-slider), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (14)

Giovanny Marquez

Does anyone have a working version for the latest matlab?

SHUBHAM YADAV

Not working for MATLAB 2018b, Can someone help me with the new version??

Adam Pacewicz

I fixed it for Matlab 2019b, if you like I can send you the new version.

Rafael Schwarzenegger

unfortunately not working

Jozef Lukac

I'm using matlab 2014a. I had to change the command setappdata(gcf,'s',s); on line 106 to this:
setappdata(gcf,'s',s(:));
Now, it works OK. Thanks.

Varuna De Silva

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!

Alec MacKendrick

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.

Alec MacKendrick

Dan Ellis

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

Dan Ellis

Matthew

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

Marc

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 Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux