Error set data of table by using eventdata.Indices inside CellSelectionCallback
Mostra commenti meno recenti
Hallo everyone,
this Error Shows up only after using set(handles.table,'Data',data):
Index exceeds matrix dimensions.
Error in GUI1>table_CellSelectionCallback (line 3197)
row_s = eventdata.Indices(1,1);
table has two columns (students and presence ) and rows(depending on how many Student in the class. let's say 10).
what i want is: if the the teacher clicks on the name of any Student (column student), on the table (cloumn presence) should marked true.
this my code Looks like:
function table_CellSelectionCallback(hObject, eventdata, handles)
row_s = eventdata.Indices(1,1);
col_s = eventdata.Indices(1,2);
%row_s = eventdata.Indices(1); % I tried this too, it gave the same Error
%col_s = eventdata.Indices(1); % I tried this too, it gave the same Error
data=eventdata.Source.Data
data(row_s,(col_s+1))={[true]}; % or olny true witout {[]} is the same result
% data(row_s,(col_s+1))=true; % tried this too, it gave the same result (Error)
set(handles.table,'Data',data)
I appreciate any help
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Develop Apps Using App Designer in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!