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

GUI 删除表格出错

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
代码
6 T& s7 H. f! g% k/ Sfunction uitable1_CellSelectionCallback(hObject, eventdata, handles)
# k9 q1 t$ l/ }# E& |( @) {9 U* A" c( ?% hObject    handle to uitable1 (see GCBO)2 m( o8 H3 k* t
% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
1 Z4 _7 l# l8 J& J0 [%        Indices: row and column indices of the cell(s) currently selecteds/ s5 u. i/ O3 j; H- r! e
% handles    structure with handles and user data (see GUIDATA)+ @1 I: ^; t+ K7 c
newdata=get(h0bject,'Data');5 v( n1 K% d8 V4 `9 |- J' {: A5 m
hang=eventdata.Indices;- Z- G; n7 [' {
hangIndex=hang(1);+ [$ h! a9 k; P' D' a: T" e
handles.hangIndex=hangIndex;0 |+ m% |  j( S1 y, c+ {; u+ r
guidata(h0bject,handles);( ^: _- X, o5 F& Y* U& R  z7 {- G6 ~
% --- Executes on button press in pb2./ P, Y( y0 |+ Y, w" W
function pb2_Callback(hObject, eventdata, handles)
7 l5 z- J# c( y6 O/ O. s% hObject    handle to pb2 (see GCBO)
2 B0 t4 g: b1 l0 W& d1 Q, q% eventdata  reserved - to be defined in a future version of MATLAB
& A4 O- O( L! c% handles    structure with handles and user data (see GUIDATA)
/ ~% k0 U2 d! c! J+ }& f. jhangIndex=handles.hangIndex;
: a; Y+ K  q' a! anewdata=get(handles.uitable2,'Data');1 W! X2 K" B$ O% J5 L( G" b
newdata(hangIndex,: )=[];
+ [7 S$ W8 D2 ^9 \( Vset(handles.uitable2,'Data',newdata);
6 I( D; `  M( P/ msave('newdata.mat','newdata');  j- I3 ^0 n' D5 O) V
function uitable2_CellSelectionCallback(hObject, eventdata, handles)
8 U  z4 U9 ^1 }: {- {2 {% hObject    handle to uitable2 (see GCBO)! ?8 ^& N7 M) J! m3 \) N6 q; z
% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
- p; c4 J4 M1 V0 J1 [  h%        Indices: row and column indices of the cell(s) currently selecteds
/ H; ]' t8 D4 J9 F4 N  d2 q: z% handles    structure with handles and user data (see GUIDATA)
8 A3 a( [& y7 P' D& ~4 anewdata=get(h0bject,'Data');2 c9 n/ f- s# `" O+ ^2 n7 H3 L
hang=eventdata.Indices;
9 a2 B/ Z' @5 g  G( E1 lhangIndex=hang(1);
1 L8 }' Z& e4 ^, \; E: }& Yhandles.hangIndex=hangIndex;
9 }* P  @' |2 S+ C0 h) [/ f+ L+ bguidata(h0bject,handles);* X5 }$ C7 b) ^1 r* J4 C
% --- Executes on button press in pb4.  c( I8 K8 ^7 C
function pb4_Callback(hObject, eventdata, handles)
- z( n& j' C1 P+ x% hObject    handle to pb4 (see GCBO): w* l  U+ Y$ c; a
% eventdata  reserved - to be defined in a future version of MATLAB* X5 O- I$ d5 n! _
% handles    structure with handles and user data (see GUIDATA)
5 _2 }" ]: l- QhangIndex=handles.hangIndex;5 e, n# P% x  j7 }
newdata=get(handles.uitable2,'Data');
# x! M5 f. m. V% |newdata(hangIndex,: )=[];. j' ]+ z7 H. G1 U. H# r
set(handles.uitable2,'Data',newdata);
& y/ ]  I' s* v. K! T% y0 s" D" Hsave('newdata.mat','newdata');
+ ]1 @' x2 R* w. R9 L( s. k: u$ b( d( p
错误提示
9 `0 A. c+ c7 n" E" i* p8 l* ?9 N6 s

. \# Q$ a4 k- r出错
* \7 d4 Y% H/ {matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb2_Callback',hObject,eventdata,guidata(hObject))
5 p) D  e+ a) j' ]+ [计算 UIControl Callback 时出错。$ G" G8 }. Y0 `/ s1 m7 @: ^) p

, ?# p+ O4 }, E6 k* a6 P- \引用了不存在的字段 'hangIndex'。
- g; `0 A6 K4 Y9 \! y  |# i
: F# ~( {# _% T  L# R2 U/ g! @出错 one4>pb4_Callback (line 146)8 l; @3 T/ K9 s6 s1 e
hangIndex=handles.hangIndex;( v" A6 E: J, |
: c0 o( K+ ~- Q& O) _( W
出错 gui_maiNFCn (line 95)- a0 j" ]6 c8 X- I0 S
        feval(varargin{:});+ ?" v3 n: n  k1 @) z5 V
( Q+ G7 D* p+ f* ~8 p/ R% f
出错 one4 (line 42)9 c7 d2 D1 r: m2 F1 i3 _* Q
    gui_mainfcn(gui_State, varargin{:});0 J! @" l3 S4 A. b* E

% L, B5 ~$ Y; I. y! N4 \/ o出错1 x' b( h4 A2 A, l) [8 V' H0 I2 N
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb4_Callback',hObject,eventdata,guidata(hObject))
& {: `; L5 P) v  z/ c计算 UIControl Callback 时出错。
' e! E! N6 l% q; E; q  c1 K

该用户从未签到

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

本版积分规则

关闭

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

EDA365公众号

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

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

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

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

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