App Designer or GUIDE- Store and Use Multiple Inputs from the edit box

2 views (last 30 days)
I am trying to create a plot or figure in the plot, from which the user inputs the the x and y coordinates to plot a point using only two edit boxes. How can you program the edit box to allow it to store a number of (x,y) coordinates without clearing the figure plotted? Refrences and help are appreciated.
Patrick Perales
Patrick Perales on 26 Mar 2019
Yes the "hold on " worked well to keep all the points plotted by the user. Thank you for that. However now the code does not store the vaules into the table provided by the GUI. THe code is written as,
function X_coord_Callback(hObject, eventdata, handles)
handles.X_coord = str2double(get(hObject,'string'));
guidata(hObject, handles);
function Y_coord_Callback(hObject, eventdata, handles)
handles.Y_coord = str2double(get(hObject,'String'));
guidata(hObject, handles);
function Coord_button_Callback(hObject, eventdata, handles)
hold off
x_coord = handles.X_coord;
y_coord = handles.Y_coord;
axis([0, max(x_coord)+1, 0, max(y_coord)+1])
trussoline = line(handles.X_coord, handles.Y_coord, 'Marker','o','LinStyle','-');
x = {handles.X_coord};
y = {handles.Y_coord};
data = get(handles.xy_coorddata,'Data'); % xy_coorddata is a function --> function xy_coorddata_Create(hObject, eventdata, handles
for i = 1:handles.deg_free % For loop is used to repeat the storing of values, however this is not what happens the values are displayed in the command window
x = {handles.X_coord};
y = {handles.Y_coord}; = get(handles.xy_coorddata,'Data',data) % This function is used to store the variables into the table which is what happens, however,
data = [x;y]; % like the problem with the points the values are erased with each new point plotted
function deg_free_Callback(hObject,~,handles)
handles.deg_free = str2double(get(hObject,'String'));
guidata(hObject, handles);
So the question is why it does the code not store the values, consecutively, into the table? Is it due the line object you referenced or will I need a struct of some sort? Any reference is appreciated. Thank you

Sign in to comment.

Answers (0)


Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!