Error using get There is no string property on the Root class

1 view (last 30 days)
In case it helps, I am trying to write a code using user input. The user inputs data into two edit boxes, an X and a Y. The coordinates are then to be stored into the table when the push button is clicked on. Any reference is accepted. Thank for the help.
Error using get % The error message
There is no string property on the Root class %
XData = get(handles.X_coord, 'string'); % That is the error is occuring
% THe follwoing is what I have written with reference to some videos on youtube
% --- Executes just before Truss_ANA is made visible.
function Truss_ANA_OpeningFcn(hObject, eventdata, handles, varargin)
global p
p.Table_coord = [];
handles.output = hObject;
guidata(hObject, handles);
handles.output = hObject;
guidata(hObject, handles);
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);
% --- Executes on button press in Coord_button.
function Coord_button_Callback(hObject, eventdata, handles)
x_coord = handles.X_coord;
y_coord = handles.Y_coord;
axis([0, max(x_coord)+1, 0, max(y_coord)+1])
trussmember = line(x_coord,y_coord,'Marker','.','LineStyle','-');
global p
XData = get(handles.X_coord, 'string');
YData = get(handles.Y_coord, 'string');
p.Table_coord = [p.Table_coord; [{XData} {XData}]];
set(handles.Table_coord, 'Data', p.Table_coord)
% The portion in the comments is another version of what I am trying to do
%data = get(handles.Table_coord,'data');
%for i = 1:handles.deg_free
% x={handles.X_coord};
% y={handles.Y_coord};
% data= set(handles.Table_coord,'data');
%data{end,i} = data{end,x};
%data{end+1,i} = data{end+1,y};
%set(handles.Table_coord, 'data',data)
% = get(handles.Table_coord, 'data');
%data = [x;y];
handles.output = hObject;
guidata(hObject, handles);
hold on

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!