MATLAB: Error after clicking in pushbutton “Parent must be a scalar graphics handle.”

MATLAB

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%%Jesli radio1 jest zaznaczone to obliczy deformacje pomiaru 0-N
%%Obliczanie Obniżeń
[num,txt]=xlsread('dane0.xlsx');
num(isnan(num))=00;
x=num
set(handles.tabela0,'data',x);
x=get(handles.tabela0,'data');
w=x(:,3)-x(:,2);
wpoz=x(1:end,1);
calosc=[wpoz w]
set(handles.tabelaw,'data',calosc);
x=get(handles.tabela0,'data');
wykresww = findobj('Tag', 'axes1');
plot(wykresww,calosc(1:2:end,1),calosc(1:2:end,2));
After clicking Run, and click in pushbutton2 I have results but If I click again in pushbutton2 I have error:
ccc.png

Best Answer

Whenever you're troubleshooting an error in this forum, include the entire error message and indicate what line is causing the error. I have a pretty good guess at the source of the error but I'm not certain without having that information.
Possible source
I think the first line below returns an empty value in wykresww or it returns more than one handle.
wykresww = findobj('Tag', 'axes1');
plot(wykresww,calosc(1:2:end,1),calosc(1:2:end,2));
If it's empty, that means you don't have an object with the tag 'axes1'. If it has more than one handle, that means you have multiple objects with the tag 'axes1'.
Solution
Rather than searching for your axis, why not grab its handle directly from the 'handles' variable? For example, if the handle to your axis is handles.axis1,
plot(handles.axis1, calosc(1:2:end,1), calosc(1:2:end,2));
If you must use findobj() (which you shouldn't) you need to make sure it's finding the correct object.
Related Question