|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
本人碰到如下问题:
编辑文本框时数据怎么才能传送到我自己的程序里面去,在论坛里面看了一些帖子,也照着一些朋友提供的方法试过,但是行不通,出现如下错误提示:
??? 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)
% eventdata reserved - 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)
% eventdata reserved - 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=[0,cos(aa1),0;-cos(aa1),0,sin(aa1);0,-sin(aa1),0];
E=[1,0,0;0,1,0;0,0,1];
B1=E+a1*sin(data.Ix)+a1*a1*(1-cos(data.Ix));
各位只要看到data.Ix的定义及使用这一段就可以了。。我是新手,对于这种情况实在是不会分析,只能试,现在试不出来,只能上这儿来向各位高手求助了。。请大家帮忙分析一下是什么原因!!
怎样将可编辑文本框的输入内容传递到我自己的运算程序里面去。。谢谢! |
|