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

GUI 删除表格出错

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
代码
9 S# \# z- I. p9 ]" o6 @function uitable1_CellSelectionCallback(hObject, eventdata, handles)  |8 f2 G* P' u5 A+ c% f
% hObject    handle to uitable1 (see GCBO)
* s) k" Q' R& \4 g/ w% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE), i! z9 `7 Z$ _; p: u
%        Indices: row and column indices of the cell(s) currently selecteds
9 T) }3 C9 ]8 ]3 e; _7 g  }% handles    structure with handles and user data (see GUIDATA)
$ [' e. W  ?& q. P0 E5 i) w# wnewdata=get(h0bject,'Data');9 G8 G9 {8 }, c5 }
hang=eventdata.Indices;- I8 _2 T6 B# F4 S
hangIndex=hang(1);
! t8 F% l2 Y: a& ~/ N! whandles.hangIndex=hangIndex;' S4 d- S. @5 I* R+ l2 X! z
guidata(h0bject,handles);$ Z% H% L  g! [4 V& p
% --- Executes on button press in pb2.
$ x% W  T. W- [$ Vfunction pb2_Callback(hObject, eventdata, handles)1 b. H$ q9 C; P
% hObject    handle to pb2 (see GCBO)
( c; e8 s! N! R' @) u: J0 C: R2 A2 U3 c% eventdata  reserved - to be defined in a future version of MATLAB" U" d% \6 a' X9 ~# h3 |8 r7 R( V
% handles    structure with handles and user data (see GUIDATA)- g4 m5 B! ]( P+ l8 Z7 r
hangIndex=handles.hangIndex;# y& G9 @; b3 Z; @. }7 J- c
newdata=get(handles.uitable2,'Data');& r6 o. c- `) Z! @6 C/ D
newdata(hangIndex,: )=[];, {. m# c- b. P1 d
set(handles.uitable2,'Data',newdata);
) O' K4 L$ I+ j+ K! N$ \4 csave('newdata.mat','newdata');
  B4 k, Z( m, ~0 g/ H' ifunction uitable2_CellSelectionCallback(hObject, eventdata, handles)2 X+ _% P8 _; ?7 J) B
% hObject    handle to uitable2 (see GCBO)* U- `, T& n" S% c1 z: I. ?2 e: r4 B- V
% eventdata  structure with the following fields (see MATLAB.UI.CONTROL.TABLE)( K& P7 ~) t* K6 R- H
%        Indices: row and column indices of the cell(s) currently selecteds8 m! O; [! s/ P+ t- i. G
% handles    structure with handles and user data (see GUIDATA)
& p1 F3 Y  Q! c$ |% }4 Nnewdata=get(h0bject,'Data');
0 x: `4 T" k! s. T4 h+ x% Shang=eventdata.Indices;# K( A- ?9 o8 ~+ h6 I8 n
hangIndex=hang(1);
: y& |9 ]  k: [, \handles.hangIndex=hangIndex;
' R+ f) ^4 l; {* X% h# a3 \& Tguidata(h0bject,handles);
7 [+ S1 f1 `, v( K# F6 e% --- Executes on button press in pb4.5 k4 U/ G/ w& e8 K! D+ V5 j4 ?2 U' r
function pb4_Callback(hObject, eventdata, handles)
, H4 g2 `5 A/ T& ^( G2 F% hObject    handle to pb4 (see GCBO), y! Y, t" z4 V. l; |
% eventdata  reserved - to be defined in a future version of MATLAB/ C& ~; Z4 z1 F5 b; O. F4 F( ?
% handles    structure with handles and user data (see GUIDATA)
4 B* x/ M, A, v( P" F8 N/ BhangIndex=handles.hangIndex;
3 W! k$ r8 }2 Z3 k3 O: @, K9 u( ~newdata=get(handles.uitable2,'Data');
8 L* H, W5 w4 w+ A+ snewdata(hangIndex,: )=[];
* h& T/ ?5 ^' h: S7 qset(handles.uitable2,'Data',newdata);
  k' |4 H/ ^  m+ f- }save('newdata.mat','newdata');- q2 ]+ x; G2 T+ W1 k: d, I* A4 P

7 {% |- Q, ]- o: G$ }, a错误提示' D5 K3 o. h% h/ w4 z
. z' a3 \5 T- h4 X9 M5 i4 ^
1 h: I' C1 \; R/ {5 s* S
出错
/ g! s1 n6 P3 k9 L, R$ }matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb2_Callback',hObject,eventdata,guidata(hObject)) * Q2 ^% ^2 E. x. B: K2 e: d
计算 UIControl Callback 时出错。4 I1 X) [+ R2 d/ [5 {: B

, d2 @9 B0 ^5 j+ j* B. ?& s引用了不存在的字段 'hangIndex'。- c) P. N" T* H: {3 ~6 C9 z

; y0 o4 B; b* r( A2 s出错 one4>pb4_Callback (line 146)
4 F( N+ o2 y' j! k$ |hangIndex=handles.hangIndex;- o, o" f- `7 K* J  X; h9 r! v' {
; l1 Z4 e( n% Q' j* l! t
出错 gui_maiNFCn (line 95)% G2 A' {: u$ Q$ _9 Y' O
        feval(varargin{:});0 ]; f2 U% O/ z4 p5 O1 N% G

4 B6 k& a) d8 D0 L& _. `+ [出错 one4 (line 42)
- s8 R0 W' e6 @! N    gui_mainfcn(gui_State, varargin{:});7 X; m: K2 N6 V* `1 ]% o
, ^" k2 J6 d7 s
出错6 b0 Z. U6 G9 k$ S+ J- c
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb4_Callback',hObject,eventdata,guidata(hObject)) : O; f6 [! H2 K. ~
计算 UIControl Callback 时出错。8 _2 P0 a6 R$ p# z( H0 ?

该用户从未签到

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

本版积分规则

关闭

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

EDA365公众号

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

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

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

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

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