# GUI function from Edit

5 views (last 30 days)

Show older comments

Hello matlab people community

I am so new to use matlab. I try to take some function respect to x, from edit1 which is name of the component, then I push a button , function of plot will see on the axes? I need a code how to call the function from the edit?

I write the codes here

function pushbutton1_Callback(hObject, eventdata, handles)

axes(handles.axes1);

x=0:0.1:10;

handles.a = get(handles.edit1,'String');

plot(x,a);

Thanks!!!

### Accepted Answer

engineerOfPhysics
on 13 Mar 2013

##### 6 Comments

Image Analyst
on 19 Mar 2013

### More Answers (2)

Alessandro
on 13 Mar 2013

Edited: Alessandro
on 13 Mar 2013

you got there a string maybe you should first convert it to an array ! Try this simple solution:

handles.a = get(handles.edit1,'String');

tmpa = str2num(handles.a)

plot(x,tmpa);

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!