liyouyuan204 发表于 2009-1-8 15:36

编辑框文本传输问题

本人碰到如下问题:
编辑文本框时数据怎么才能传送到我自己的程序里面去,在论坛里面看了一些帖子,也照着一些朋友提供的方法试过,但是行不通,出现如下错误提示:
??? Undefined variable "data" or class "data.Ix".
Error in ==> gui_lsq>pushbutton1_Callback at 425
B1=E+a1*sin(data.Ix)+a1*a1*(1-cos(data.Ix));
Error in ==> gui_mainfcn at 75
      feval(varargin{:});
Error in ==> gui_lsq at 45
    gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback.


在Ix的回调函数下,我用的代码是:
function edit18_Callback(hObject, eventdata, handles)
% hObject    handle to edit18 (see GCBO)
% eventdatareserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit18 as text
%      str2double(get(hObject,'String')) returns contents of edit18 as a double
user_string=get(hObject,'String');
user_entry= str2double(get(hObject,'String'));
if isnan(user_entry)
    errodlg('You must entry a number value','Bad Input','model')
% else Ix=user_entry*pi/180;
end
data=getappdata(gcbf,'metricdata');
data.Ix=user_entry;
setappdata(gcbf,'metricdata',data);


而在我进行运算的主程序里,我用的代码是:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdatareserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
button_state=get(hObject,'Value')

if button_state==get(hObject,'Max')
syms u t b wt wp O xm ym zm
ww=1;
w=6.33912;
c=ww*t;
f=w*t;
%旋转刀倾角
aa1=15*pi/180;
a1=;
E=;

B1=E+a1*sin(data.Ix)+a1*a1*(1-cos(data.Ix));


各位只要看到data.Ix的定义及使用这一段就可以了。。我是新手,对于这种情况实在是不会分析,只能试,现在试不出来,只能上这儿来向各位高手求助了。。请大家帮忙分析一下是什么原因!!
怎样将可编辑文本框的输入内容传递到我自己的运算程序里面去。。谢谢!

liyouyuan204 发表于 2009-1-8 15:38

19372612
这是我的qq,如果方便,请q我,多多指教!!!
页: [1]
查看完整版本: 编辑框文本传输问题