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

GUI 删除表格出错

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
代码
4 c% |- L2 k; O& F7 ifunction uitable1_CellSelectionCallback(hObject, eventdata, handles)
4 v4 z$ p4 r" b" U9 \' {% hObject    handle to uitable1 (see GCBO)$ w! F3 e" Y% r; y" s; Q$ n
% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)% M0 z$ P4 y7 ], @" i3 o
%        Indices: row and column indices of the cell(s) currently selecteds
/ e) y) j) x* Q6 w! h. g% handles    structure with handles and user data (see GUIDATA)
0 W) y  Q' M! I8 c4 G- xnewdata=get(h0bject,'Data');
' o$ p6 J. j% L0 y/ {hang=eventdata.Indices;! t. \1 ^/ h* g
hangIndex=hang(1);
9 W5 ], G! E/ v% V& yhandles.hangIndex=hangIndex;4 l, p/ [- h) w& ?( O9 [. P
guidata(h0bject,handles);
) N2 r0 |5 b1 _2 _7 o% --- Executes on button press in pb2.
( p- a2 H, f! n! F, ^- X5 Y6 b# u' ?' x4 [function pb2_Callback(hObject, eventdata, handles)
: h# j7 i# F3 {% hObject    handle to pb2 (see GCBO)5 r# i0 U* v1 @2 ], c
% eventdata  reserved - to be defined in a future version of MATLAB1 G% ~9 V% [/ I0 V
% handles    structure with handles and user data (see GUIDATA): r, \, J5 G  d" ?" j; F; }
hangIndex=handles.hangIndex;5 F% v% |' P5 F; w3 {
newdata=get(handles.uitable2,'Data');! F3 j& t1 T3 t6 E
newdata(hangIndex,: )=[];. E% \; I# t, Z- x' V
set(handles.uitable2,'Data',newdata);
- O4 X! X! R$ U2 v. Y5 g& X( tsave('newdata.mat','newdata');% n% t+ Z0 G+ l& a0 V
function uitable2_CellSelectionCallback(hObject, eventdata, handles)
$ ?9 S6 I& [) \, F% hObject    handle to uitable2 (see GCBO)7 n" Q9 l1 l  D" V) J! x
% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
+ n% B3 Q2 t# I%        Indices: row and column indices of the cell(s) currently selecteds3 J5 C' h( r# w' {% p2 E
% handles    structure with handles and user data (see GUIDATA)6 x, b& M# D! J" P$ X7 L
newdata=get(h0bject,'Data');) G! z' W$ T& F3 Y: g* O
hang=eventdata.Indices;
' [$ K) W( e2 j; VhangIndex=hang(1);
* y0 ]$ S8 ?  Mhandles.hangIndex=hangIndex;
3 V5 C5 m4 \% `" l& \guidata(h0bject,handles);6 }+ x7 I. i8 w, g
% --- Executes on button press in pb4.+ h+ C0 r" ?& I  J
function pb4_Callback(hObject, eventdata, handles)8 T, C: k% L# U6 w
% hObject    handle to pb4 (see GCBO)
/ d; R5 F% j6 C, ~  u7 ]% eventdata  reserved - to be defined in a future version of MATLAB% e- v! i8 j9 b- n3 [' E- j, ]
% handles    structure with handles and user data (see GUIDATA)7 s, x+ i; L, M7 x' C
hangIndex=handles.hangIndex;
8 A* `' h* e4 b* t. _newdata=get(handles.uitable2,'Data');
: I# ]& h8 w: s, g( B3 R' rnewdata(hangIndex,: )=[];& ~: p6 t  G/ n1 J
set(handles.uitable2,'Data',newdata);
. S, o; e+ M+ u- |2 {- G. e8 tsave('newdata.mat','newdata');
  z) U" U( W6 [) I. Y4 Y  F9 c: g/ ~1 C# k5 r$ k
错误提示' A; y& \" D+ F! h
: J' r: g: a# @$ Y
: z# Q3 e5 l8 L2 a6 q
出错
7 w. v6 M1 R4 j( L$ q$ [matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb2_Callback',hObject,eventdata,guidata(hObject))
! C2 ^% c) ?2 ]4 s# p计算 UIControl Callback 时出错。! p6 w) ]- y9 e  q! K  |7 g

, R$ N6 E/ ]3 U1 E' a+ N: b# P. W引用了不存在的字段 'hangIndex'。
' @6 h2 s& x; H
' d3 G, p% n* B5 f出错 one4>pb4_Callback (line 146)
3 G% m' p3 T- u, r- a* YhangIndex=handles.hangIndex;# i# n. n* x& H, {+ o9 v

: ]1 @8 K; c" D2 _出错 gui_maiNFCn (line 95). i! l  o6 r2 a
        feval(varargin{:});4 o" d8 s% [" e; L: v# O
' R% ]' \" w( |+ e2 n( w3 b- b- U  D
出错 one4 (line 42)' R! G& H+ W2 c5 L# T* Z3 f
    gui_mainfcn(gui_State, varargin{:});
* P  ^' J- O3 u* Z& ^, j/ y: [' J/ ~) `: N) Z* n
出错1 e7 }( F! A# D" A7 S
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb4_Callback',hObject,eventdata,guidata(hObject)) , ?: L* ]! X* u+ s
计算 UIControl Callback 时出错。1 _4 N* ?1 w9 s) K# k1 I# f1 o8 h

该用户从未签到

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

本版积分规则

关闭

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

EDA365公众号

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

GMT+8, 2025-11-24 12:42 , Processed in 0.156250 second(s), 24 queries , Gzip On.

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

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

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