File Exchange

image thumbnail

Interactive curve class

version 1.2 (51.5 KB) by

change curve by markers drag-and-drop

3.66667
3 Ratings

7 Downloads

Updated

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

http://simulations.narod.ru/

See how it works on this video:
http://youtu.be/cjej0nf0fcY

All class is interactive_curve.m file.
See help about this class:
1) set current directory to directory where interactive_curve.m place
2) type
doc interactive_curve
in command window and push enter.

It is possible to change markers style, interpolation method, generate m-file ect.

Comments and Ratings (8)

Amit

Amit (view profile)

Maxim,

Excellent work! But I have a question.

How can I define a userdefined function for interpolation? For example, defining a exponential decay function with ends as control points? (y=y0*exp^(-d*t)); where y0 is initial quantity, t is time, d is decay per unit time.

So when I drag the control points the curvature of the curve is controlled by exponential decay function and d gets calculated based on initial and final position of the control points (d = [log(y2) - log(y1)]/[x2-x1]).

Thanks in advance.

Maxim Vedenyov

Maxim Vedenyov (view profile)

robert howrd, main thing here is not GUI, it is object that you can insert to any GUI. For example waveform generator: http://www.mathworks.com/matlabcentral/fileexchange/35183-waveform-generator-gui-2

robert howrd

confusing, GUI not well done, hard to use, not user friendly.

Maxim Vedenyov

Maxim Vedenyov (view profile)

Jiro Doke, I made this

Jiro Doke

Jiro Doke (view profile)

You can make a property (SetAccess = protected). Then I can still type:

m = ic.method

But I can't do this:

ic.method = 'BadMethod';

Maxim Vedenyov

Maxim Vedenyov (view profile)

But what is the user want to know what method of interpolation is used curently than it will use m=ic.method; ic.setMehtod(...) change the method of interpolation and redraw line.

Jiro Doke

Jiro Doke (view profile)

Oops, my original comment got deleted.

At first, I didn't realize you had all of these set* methods. I was trying to change the properties directly, because they were all public. My suggestion was to make some of the properties protected or hidden (if it's only used internally)

Jiro Doke

Jiro Doke (view profile)

After playing with it some more, I realized that I was supposed to use the set* methods for change different properties. I see that if I use "setMethod" method, it updates the plot correctly.

I think that means the "method" property should be (setAccess = protected), so that people cannot change it.

Updates

1.2

Update No.2: set protected property for .method, mouse methods and figure close methsod now protected methods.

1.1

Update No. 1: marker color bug fixed, aditional dilte, new method: setMarkersPositions(), new property additionalDeleteFunctionHandle and other improvements.

MATLAB Release
MATLAB 7.11 (R2010b)

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

» Watch video

example1_just_run/

example2_user_inrerpolation/

example3_gui/

example4_with_guide/