Passing numbers from edit field to graph

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Passing numbers from edit field to graph

Carola Forster
Dear Support-Team,
 
I am programming a Graphical User Interface to create simple graphs. Find a attached my created interface (gui.docx) and my code (ButtonsTools.txt). I want that when I type in a number in the edit field xmin, xmax and xstep that the x-axis is adapt, but I don´t know the suitable command for it. Can you help me?
So what I actually want is, that x=xmin:xstep:xmax, but I don´t know how to hand over it to the GUI.
 
Thank you for your help.

Carola Forster



ButtonsTools.txt (6K) Download Attachment
GUI.docx (60K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Passing numbers from edit field to graph

Tony Richardson
> Subject: Passing numbers from edit field to graph

>
> Dear Support-Team,

> I am programming a Graphical User Interface to create simple graphs. Find a attached my created interface (gui.docx) and my code
> (ButtonsTools.txt). I want that when I type in a number in the edit field xmin, xmax and xstep that the x-axis is adapt, but I don´t
>  know the suitable command for it. Can you help me?
> So what I actually want is, that x=xmin:xstep:xmax, but I don´t know how to hand over it to the GUI.

> Thank you for your help.
>
> Carola Forster
Hi Carola,
I've been working on something very similar.  You need to add a callback function that is automatically run when the edit field is changed.  The callback will need to get the new value from the control element and then replot the graph.

I have attached an m-file that illustrates the procedure.  (By default the x-axis is autoscaled, but you can click on the "AUTO" button to switch to "MANUAL" mode and then enter new values in the "min" and "max" edit controls.)  I hope this helps.

Tony Richardson

p.s. The attached script allows the user to explore function composition using unit step and unit ramp functions.



sim00_01.m (18K) Download Attachment