找回密码
 注册
关于网站域名变更的通知
查看: 251|回复: 2
打印 上一主题 下一主题

GUI 删除表格出错

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2020-9-17 16:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
代码
; s8 M0 \' n& v' r, m! z, Y8 Cfunction uitable1_CellSelectionCallback(hObject, eventdata, handles)
! e* O4 @& @( f+ {1 s- C" p$ j% hObject    handle to uitable1 (see GCBO)% ^' }, N( R. u  }' `4 P
% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)9 u& {/ [* p' n, @* e* g; ~
%        Indices: row and column indices of the cell(s) currently selecteds
( v7 L7 r5 v; h6 h% handles    structure with handles and user data (see GUIDATA)% K6 l- H! ]# u
newdata=get(h0bject,'Data');
  L% v8 X/ h% k; C* shang=eventdata.Indices;: W) Z+ o7 |% p4 |4 x
hangIndex=hang(1);
/ R: N% p' P7 h2 }: }handles.hangIndex=hangIndex;
( g% B6 b0 g4 Y2 n& Tguidata(h0bject,handles);( @) a8 T) {! C" S6 [( K& m
% --- Executes on button press in pb2.2 R3 |) [% [4 E* k+ d
function pb2_Callback(hObject, eventdata, handles)
) h! M$ V! v; l! P7 @% hObject    handle to pb2 (see GCBO)2 q/ H/ u' r- d0 M# B
% eventdata  reserved - to be defined in a future version of MATLAB+ u3 F' y% ~  V
% handles    structure with handles and user data (see GUIDATA)" U8 _4 k% k; \& I5 g3 n
hangIndex=handles.hangIndex;
+ U$ w/ C+ @; T) d. gnewdata=get(handles.uitable2,'Data');
* I! D5 u6 b# `2 T. p. G7 L0 [$ Ynewdata(hangIndex,: )=[];
# h; `* n9 F! z" C, e& A, M* Bset(handles.uitable2,'Data',newdata);
* d# @, x' D: K; Isave('newdata.mat','newdata');
) E# }% x" @+ G2 v, P. lfunction uitable2_CellSelectionCallback(hObject, eventdata, handles)$ a. O/ m4 s: W& n( G
% hObject    handle to uitable2 (see GCBO)
  t. @* B) G, t. @& g  S% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
- i6 A% m5 s0 P2 V6 T1 k%        Indices: row and column indices of the cell(s) currently selecteds
& H- q' I$ h9 w! ~# P! K. a% handles    structure with handles and user data (see GUIDATA)
5 E8 U  V+ `0 Q$ Fnewdata=get(h0bject,'Data');
2 G7 x) _2 t/ a6 z4 R# r( _hang=eventdata.Indices;
6 n4 D. \1 X! ^( l1 C; }8 I' BhangIndex=hang(1);
3 N% ^" x+ M) f9 `handles.hangIndex=hangIndex;& v, Q! [% j, }2 n4 y7 e
guidata(h0bject,handles);
# q( Q0 ?4 J8 P7 ?& n2 K% --- Executes on button press in pb4.
; a6 n7 u& J) J+ rfunction pb4_Callback(hObject, eventdata, handles)9 V' K4 o9 p1 i! o$ m) ^3 e
% hObject    handle to pb4 (see GCBO)
# Y+ O4 `1 s# Y1 V5 \3 _% eventdata  reserved - to be defined in a future version of MATLAB
+ r# J" G! v4 u+ O% X! ^4 _6 b% handles    structure with handles and user data (see GUIDATA); j4 u9 I' ]4 O+ @. w
hangIndex=handles.hangIndex;7 R; u  D& g* k+ ]7 w9 w
newdata=get(handles.uitable2,'Data');# a/ ], d, \9 L* D. D0 w9 Z
newdata(hangIndex,: )=[];
* [: A; m, w; b: P, wset(handles.uitable2,'Data',newdata);
0 l9 z; W& F( Tsave('newdata.mat','newdata');/ c4 I2 V5 Y- n: b

% [( s$ q1 T- d) Z错误提示
; V" ~2 \( L! h* \, I, u. j, K$ |+ z& \& ]. g

% D( U1 |' Q9 b7 q' ]出错
6 r3 b5 N/ S$ Imatlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb2_Callback',hObject,eventdata,guidata(hObject))   l/ k2 [. W- x0 q& z( r) p+ E
计算 UIControl Callback 时出错。
9 A# _2 h, k7 T9 L3 n
" B2 @+ f/ }$ b' W+ v$ T' \引用了不存在的字段 'hangIndex'。3 O) {; g6 e, e
3 Y4 @  p% r! ?/ y
出错 one4>pb4_Callback (line 146)
$ W9 |- y4 l+ H9 BhangIndex=handles.hangIndex;
* p2 l/ l0 t' C, M; Z" P0 u" x% I+ r- E9 p
出错 gui_maiNFCn (line 95); U1 a$ \* q7 g: ^5 H9 a
        feval(varargin{:});/ a# a7 o2 s* u/ ?/ Y
# L7 Q2 n$ J) l: [, `6 p- M
出错 one4 (line 42)5 i' e/ S4 L- t* [
    gui_mainfcn(gui_State, varargin{:});
/ ~) T( y# l. }. R& ?9 K2 X% h4 F8 l3 l  H/ z. q; Y
出错% a& u1 U1 X) u7 K$ M- Y4 y
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb4_Callback',hObject,eventdata,guidata(hObject))
) Q! z, o0 t$ q0 N$ v6 u" e' U% v计算 UIControl Callback 时出错。$ T& V2 x' Q6 w) l0 Q

该用户从未签到

3#
发表于 2020-9-17 17:31 | 只看该作者
这么多错误啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-7-27 18:13 , Processed in 0.125000 second(s), 23 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

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