File Exchange

image thumbnail

Manipulate: Interactive Parametrized Plotting

version 1.0.0.0 (3.87 KB) by Mingjing Zhang
An interactive plotting tool similar to (with much fewer features) "manipulate" in Mathematica

11 Downloads

Updated 03 May 2012

View License

Many Mathematica users love the simple yet powerful command "manipulate". It allows user to interactively change the parameters and watch the graphical results updated in real time. However, to their disappointment, MATLAB does not have a similar function.

Now this m file, written in pure M-script, implements the SIMPLEST functionality of its Mathematica counterpart: The user could plot a parametrized curve, and manipulate as many parameters as he wants, and most importantly, the plot will be updated in REAL TIME as the user drags the slider.

This file makes use of a 'real time' slider. The idea was similar to a previous submission of a real time slider by Matt Jones, but my implementation was performed in a completely different way and no code from that submission was used in my file.

This is just the first installment, so the only thing that you can manipulate is a 2D curve. I plan to expand its functionality to support a greater variety of graphical objects. If you want any other new features added, please let me know.

The way to pass argument to manipulate.m is similar to that in Mathematica, but not quite the same. Please use

help manipulate

for the detailed usage. Or just type in

manipulate

to watch a demonstration.

Have fun!

(Only partially tested with MATLAB R2012a and R2011a. Please report any bugs and/or inconvenience to help me improve this program.)

Comments and Ratings (10)

Felipe luar

how to add a reference graph in what I want to manipulate?

Found the fix, add this line in the script after preparing the figure (line 167)
movegui(gcf,'center')
the figure gets back to the center of the screen

Works for matlab 2018b

I am having the same issue as spantoji. Any progress on this?

spantoji

Trying to this function with R2017a. I see the figure being generated but it is minimized. I cannot open it.
Can you help me know why?

Yifei Wang

Fantastic! I m working with it for a long time.it really helps.

Zhenyu Zhou

XJ

Very useful to me, Thanks!
There are some bugs in this code.
you use persistent variable in 'slider_updater' function, which may cause the 'start(slider_timer(it))' unable to return, especially when mathfunc is complicated. It can be fixed by using a global variable to store last_slider_value.
Actually the last_slider_value is the current state of the parameters, I think there is no need to store the parameters in the line property 'UserData'.
Last, the x value, I think x wouldn't change during the function operation. So it's better to just use it in 'slider_updater' as a global variable rather than retrieving it from the line object.

Qianxi Yang

I have been using Mathematica to manipulate my parametrized plots and jump back to Matlab to continuing my work. This m file is really helpful and the coding is easy to understand. Definitely 5 star!

Hwang

I saw the code @ilovematlab. Thank u so much.

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux