I have created a table in Matlab GUIDE which has logical cells(checkboxes) in the first column. A name of a signal is stored in the second column. The code below is used to plot and delete the selected signals.
% --- Executes when entered data in editable cell(s) in uitable4.
function uitable4_CellEditCallback(hObject, eventdata, handles)
data = get(handles.uitable4, 'Data');
x = handles.x;
signalPlot = handles.signalPlot;
currentRow = eventdata.Indices(1);
if eventdata.PreviousData == 0
signalCell = data(currentRow, 2);
signalName = signalCell{1};
signal = evalin('base', signalName);
axes(handles.axes2);
hold on;
signalPlot(currentRow) = plot(x, signal);
hold off;
handles.plotThis = signalPlot;
guidata(hObject, handles);
end
if eventdata.PreviousData == 1;
signalPlot = handles.plotThis;
delete(signalPlot(currentRow));
end
This is the problematic case: When I choose 3 cellboxes, e.g. first, second and third rows. And attempt to delete the first one. I get an error:
Error using delete
Cannot access method 'delete' in class
'matlab.ui.Root'.
What can I do to achieve what I want? Thank you very much from now on.
Aucun commentaire:
Enregistrer un commentaire