声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 819|回复: 1

[编程技巧] 编辑框文本传输问题

[复制链接]
发表于 2009-1-8 15:36 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

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

使用道具 举报

 楼主| 发表于 2009-1-8 15:38 | 显示全部楼层

这是我的qq,如果方便,请q我,多多指教!!!
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-22 21:19 , Processed in 0.051644 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表