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

GUI 删除表格出错

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
代码! e' t8 |/ v3 m: N. f" p* U& b
function uitable1_CellSelectionCallback(hObject, eventdata, handles)
8 U9 W" ~) R) c: d4 U% y% hObject    handle to uitable1 (see GCBO)' a+ L: a$ u+ Z+ `
% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
8 t$ E! w& c! [. B. Q' Q%        Indices: row and column indices of the cell(s) currently selecteds! \) B; ]* U% e! n: s& B# ?  x+ P
% handles    structure with handles and user data (see GUIDATA)
5 B$ `4 p% ^- G7 `+ T! ?- inewdata=get(h0bject,'Data');1 U8 ?$ ]4 @3 {
hang=eventdata.Indices;8 m# V' _- y) Q; d$ D0 y- b
hangIndex=hang(1);
  y3 P# Z6 ~$ g! \/ a! X9 ohandles.hangIndex=hangIndex;
! v& u% v4 ]3 x% C2 Aguidata(h0bject,handles);
' S' ?8 x" _% ^( D4 U% --- Executes on button press in pb2.
: i; j8 A! g, D+ b' dfunction pb2_Callback(hObject, eventdata, handles)# A, O8 j; k5 S+ h- _& i
% hObject    handle to pb2 (see GCBO)
2 Y9 K2 @2 [" p0 \4 |% eventdata  reserved - to be defined in a future version of MATLAB
& L/ W6 |- b  X, E( d$ i% handles    structure with handles and user data (see GUIDATA)# u* |# ]1 V7 s8 d- v: z$ ]
hangIndex=handles.hangIndex;# a0 M" d; e$ }$ f2 z  J4 N
newdata=get(handles.uitable2,'Data');
8 f' d3 c! m  D$ C6 E' F* pnewdata(hangIndex,: )=[];
1 h3 s, ]% \, R* s  g: ^3 Dset(handles.uitable2,'Data',newdata);$ t6 d' w0 @4 x, N* F
save('newdata.mat','newdata');2 r8 w4 |- \4 Q5 m
function uitable2_CellSelectionCallback(hObject, eventdata, handles)
- u2 j9 Q  |* b$ A/ z; p% hObject    handle to uitable2 (see GCBO)
6 a" H4 h$ _7 U3 ?3 w: {0 S% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
/ W5 D; N, W0 v" y' Z" B%        Indices: row and column indices of the cell(s) currently selecteds8 \. _2 t; N1 ~& X! e% E! C
% handles    structure with handles and user data (see GUIDATA)
3 c6 w* e% M6 U' e" h" vnewdata=get(h0bject,'Data');
8 V$ n  v0 \  ahang=eventdata.Indices;
2 d. W, T0 l. ]hangIndex=hang(1);% T; t/ F7 _& r: d
handles.hangIndex=hangIndex;
4 Q7 K$ {9 f0 H2 nguidata(h0bject,handles);/ k5 U0 q" z6 Z* L# w% m7 c
% --- Executes on button press in pb4.
8 l2 |6 i$ G) [. Gfunction pb4_Callback(hObject, eventdata, handles): _/ T0 A' }8 Z2 q
% hObject    handle to pb4 (see GCBO)
$ a5 b& @3 z; @. H4 P0 }% eventdata  reserved - to be defined in a future version of MATLAB
& e' f# l. C( E- I8 p/ Q' M% handles    structure with handles and user data (see GUIDATA)
, P7 }- z2 g2 k5 \- Y( M+ ?# h" QhangIndex=handles.hangIndex;0 C( A& N! s+ K; A
newdata=get(handles.uitable2,'Data');
. m# D* C& |/ V- K# C/ ~6 O% pnewdata(hangIndex,: )=[];
- P9 l7 O& o3 R0 Z# eset(handles.uitable2,'Data',newdata);" v  D: ^7 T  ^" k' f- b2 C! d0 m& H
save('newdata.mat','newdata');
8 C7 G8 J* I% i& S9 w! j( M4 a! A$ J: q1 F
错误提示
- t' j# O+ ?% E% R8 P! @; m1 ?! R
- C% G) Z( V- ^$ s
出错
' A9 {- n4 J, t# W% e' A) Dmatlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb2_Callback',hObject,eventdata,guidata(hObject))
( h& R: m1 m2 U) _( K计算 UIControl Callback 时出错。2 \; Z* z& a- ^8 E) h1 D! K) w
& m; y. ~! B& c- B' O( y) D
引用了不存在的字段 'hangIndex'。
' \& _1 {) J2 @6 K6 `! @; \. V3 x* z8 F9 ^$ {
出错 one4>pb4_Callback (line 146)
* H* v8 a$ C" X  l5 `% ?( B) ?hangIndex=handles.hangIndex;
& u; r( o! ]- S8 V3 j! \
* ^& Z- f2 h/ V8 ~' T: K: n$ w出错 gui_maiNFCn (line 95)
1 R, }7 F9 a8 B8 G2 l+ W        feval(varargin{:});5 o( E- ]! f0 G7 t
1 R8 D/ j( X: u1 f+ t) m
出错 one4 (line 42)( I# K. J! Y$ s  ?' L8 Q: L
    gui_mainfcn(gui_State, varargin{:});
' R$ ~4 \; }8 \- c2 z& Y. {3 g$ c8 d6 g2 T" M9 t/ ?
出错4 }0 ], o. z! `1 s( l2 y: Z& M
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb4_Callback',hObject,eventdata,guidata(hObject))
, o, a$ @2 }9 e3 e1 ~8 G" S计算 UIControl Callback 时出错。7 v# L& i4 b2 L1 m

该用户从未签到

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

本版积分规则

关闭

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

EDA365公众号

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

GMT+8, 2025-11-24 13:13 , Processed in 0.140625 second(s), 23 queries , Gzip On.

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

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

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