MATLAB: Integration with gui. convert string to sym or syms.

convertguiguideintegrationmatlab guinumerical integrationstringsymbolic

I want to do a program. I am going to do it with Gui. This gui has two edit text. I want that; when user write an function( depent on x) like x^2 + 3*x +5.
when user click pushbutton other edit text show integral of that function.
I write that codes under callback of pushbutton :
function pushbutton_calculate_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_calculate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
syms x;
a = get(handles.edit1,'String');
b = sym('a');
set(handles.edit2,'String',sym(a));
I take this errors :
??? Error using ==> set
error: mxArray must be double, char, or cell
Error in ==> untitled3>pushbutton_calculate_Callback at 84
set(handles.edit2,'String',sym(a));
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> untitled3 at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)untitled3('pushbutton_calculate_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback

Best Answer

a = get(handles.edit1,'String');
b = int(sym(a));
set(handles.edit2, 'String', char(b));