How to store all values from cells i have edited in uitable.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Darren Koh
am 19 Feb. 2018
Kommentiert: Darren Koh
am 21 Feb. 2018
This part of the code refreshes everytime a cell is edited so the whole of handles.storedvals is overwritten, thus only displaying the value of the most recently edited cell. Is there a way to hold the values of all cells that were edited?
function uitable1_CellEditCallback(hObject, eventdata, handles)
% hObject handle to uitable1 (see GCBO)
% eventdata structure with the following fields (see MATLAB.UI.CONTROL.TABLE)
% Indices: row and column indices of the cell(s) edited
% PreviousData: previous data for the cell(s) edited
% EditData: string(s) entered by the user
% NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
% Error: error string when failed to convert EditData to appropriate value for Data
% handles structure with handles and user data (see GUIDATA)
data = get(hObject, 'Data');
indices = eventdata.Indices;
r = indices(:,1);
c = indices(:,2);
linear_index = sub2ind(size(data),r,c);
storedvals(linear_index) = data(linear_index);
handles.storedvals = storedvals;
guidata(hObject, handles);
Akzeptierte Antwort
Walter Roberson
am 19 Feb. 2018
Before
storedvals(linear_index) = data(linear_index);
do
if isfield(handles, 'storedvals')
storedvals = handles.storedvals;
else
storedvals = nan(1, numel(data));
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!