フィルターのクリア

Integration with gui. convert string to sym or syms.

2 ビュー (過去 30 日間)
oner
oner 2012 年 12 月 6 日
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

採用された回答

Walter Roberson
Walter Roberson 2012 年 12 月 6 日
a = get(handles.edit1,'String');
b = int(sym(a));
set(handles.edit2, 'String', char(b));
  1 件のコメント
oner
oner 2012 年 12 月 6 日
Thank you so much. The problem was solved thanks to you.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by