EDA365电子论坛网
标题:
GUI 删除表格出错
[打印本页]
作者:
smileqq
时间:
2020-9-17 16:09
标题:
GUI 删除表格出错
代码
6 B) Y* J4 Y# D1 Q: O5 u
function uitable1_CellSelectionCallback(hObject, eventdata, handles)
2 _0 z3 k4 O: m; a% H+ h
% hObject handle to uitable1 (see GCBO)
* I* |5 P3 U8 @# ^% j. p2 J
% eventdata structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
# I$ V' y7 y. B8 D6 E
% Indices: row and column indices of the cell(s) currently selecteds
! ~" x- B5 q7 G
% handles structure with handles and user data (see GUIDATA)
# m! Y0 V7 u- `3 ~4 Q5 K% Q' H' L
newdata=get(h0bject,'Data');
/ {8 @0 F4 d2 n6 m- l# G8 H
hang=eventdata.Indices;
" [1 @* f+ { n
hangIndex=hang(1);
! E B( f( P: |
handles.hangIndex=hangIndex;
9 W2 ?1 O) B$ t: \6 L$ s
guidata(h0bject,handles);
9 L0 @9 }2 `: n0 w, V
% --- Executes on button press in pb2.
4 D, y2 k% R' K7 B4 X; X. |
function pb2_Callback(hObject, eventdata, handles)
. D9 u' y9 L. s% a; Q
% hObject handle to pb2 (see GCBO)
+ h( e8 W I( x o0 H* d# c: E
% eventdata reserved - to be defined in a future version of MATLAB
0 v6 X2 F @9 a
% handles structure with handles and user data (see GUIDATA)
5 B* |0 F x( m/ Z) N/ @
hangIndex=handles.hangIndex;
9 h0 X: C! E' h& V
newdata=get(handles.uitable2,'Data');
0 A) [0 ~& J6 g/ U
newdata(hangIndex,: )=[];
/ T+ e- u5 Y# t5 M* F8 ^) j- F
set(handles.uitable2,'Data',newdata);
# N% d8 n8 j9 F0 z+ N* F( p
save('newdata.mat','newdata');
5 l4 r! J' [: B3 _% V( y
function uitable2_CellSelectionCallback(hObject, eventdata, handles)
0 ]$ e' q; g1 c4 ?* _9 g$ K
% hObject handle to uitable2 (see GCBO)
$ H/ ]! A, I8 n* ^- x
% eventdata structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
9 T% x" G* B. a: ~1 v$ X
% Indices: row and column indices of the cell(s) currently selecteds
: i1 t3 m1 y0 j/ \- f! g" U
% handles structure with handles and user data (see GUIDATA)
1 M1 H/ {2 W) b
newdata=get(h0bject,'Data');
8 g3 J d. ?1 ^2 U
hang=eventdata.Indices;
3 H% z8 M% M% W! Q! U
hangIndex=hang(1);
' B/ d) r+ q2 Q2 H( I
handles.hangIndex=hangIndex;
8 r3 ]% h' a! l& L
guidata(h0bject,handles);
h6 h) E6 g4 U l2 I, v
% --- Executes on button press in pb4.
+ D' C9 R: J5 h4 K) b n
function pb4_Callback(hObject, eventdata, handles)
3 M3 d! q9 V+ W; ]' E
% hObject handle to pb4 (see GCBO)
+ ~/ n& \6 A1 o9 y8 h9 C
% eventdata reserved - to be defined in a future version of MATLAB
+ S. W9 ^6 E" Y! N' V7 [4 i, ~
% handles structure with handles and user data (see GUIDATA)
0 z: M4 @' U+ @2 e3 u& ~& [2 O
hangIndex=handles.hangIndex;
2 C: X, P# `+ i6 i& t0 k& {
newdata=get(handles.uitable2,'Data');
1 G4 `8 e+ ]4 D d5 p- L
newdata(hangIndex,: )=[];
9 R' e2 d9 S5 d1 O1 @" z5 f7 V
set(handles.uitable2,'Data',newdata);
& d$ |9 e; [' a
save('newdata.mat','newdata');
* B- } k# v- ~
0 {1 K+ z; t2 J' T3 e. w4 N6 b
错误提示
! I4 y9 r: v, A
; T% J, L% p: }% G, j# H9 S
8 G/ S$ Q! J# f5 L
出错
! C7 E7 M& ?& l3 @* M3 U
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb2_Callback',hObject,eventdata,guidata(hObject))
0 P! U, B6 S5 p, z& z% F; |
计算 UIControl Callback 时出错。
) E( Q# d! H# i- D
) V+ q8 o; I* \0 W
引用了不存在的字段 'hangIndex'。
6 C: u: o$ z, ~0 ~7 {
) ^2 C0 I8 ^$ _( U; y I4 l
出错 one4>pb4_Callback (line 146)
2 B1 {& a* f2 l1 X* W5 T+ Z
hangIndex=handles.hangIndex;
, q a* M h1 i
" J' H: |5 M* ~5 M: Q3 G& c
出错 gui_mainfcn (line 95)
5 w6 ?) h8 b; Y) N' t
feval(varargin{:});
$ q0 d$ L5 u4 m0 V6 P
( _0 `' w/ E2 T; j) T% F5 d
出错 one4 (line 42)
/ n; E- g5 y+ D' q: T* m0 T% X/ O. T
gui_mainfcn(gui_State, varargin{:});
+ E) U/ X# W- ^2 m* P" Q3 N' c
* y" N+ e* s& S9 \
出错
- n! _0 K4 I8 E1 L+ [3 g
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)one4('pb4_Callback',hObject,eventdata,guidata(hObject))
: C, R0 E2 ~. T! r
计算 UIControl Callback 时出错。
2 X- a+ S( f: }1 A% i% {+ e3 n [
作者:
youOK
时间:
2020-9-17 16:58
大神啊
作者:
xiaogegepcb
时间:
2020-9-17 17:31
这么多错误啊
欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/)
Powered by Discuz! X3.2