I am new to matlab and I'm trying to make a progrem which gets parameters from the user(using gui)for x value and y value,puts them into 2 different vectors and when the user is done it uses plot to make a graph out of the two vectors.
here is what I tries to do:
function pushbutton1_Callback(hObject, eventdata, handles)x=[];y=[];a=str2double(get(handles.edit1,'string'));b=str2double(get(handles.edit2,'string'));handles.x=[x a];handles.y=[y b];guidata(hObject, handles);function Doit_Callback(hObject, eventdata, handles)axes(handles.axes1)handles.x;handles.y;handles.m=handles.x;handles.n=handles.y;plot(handles.m,handles.n);guidata(hObject, handles); function Doit_Callback(hObject, eventdata, handles)axes(handles.axes1)handles.x;handles.y;handles.m=handles.x;handles.n=handles.y;plot(handles.m,handles.n);guidata(hObject, handles);
but the plot function won't work.I'm tring to get a and b from the edit text in the gui and put them into vector x and vector y,and when I'm done adding all the element I want I'm trying to use the full vectors in the Doit function. any help would be appreciated
Best Answer