How to store all values from cells i have edited in uitable.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Darren Koh
el 19 de Feb. de 2018
Comentada: Darren Koh
el 21 de Feb. de 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);
Respuesta aceptada
Walter Roberson
el 19 de Feb. de 2018
Before
storedvals(linear_index) = data(linear_index);
do
if isfield(handles, 'storedvals')
storedvals = handles.storedvals;
else
storedvals = nan(1, numel(data));
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Whos en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!